Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88809

Excel: Range.Cut() or Range.ClearContents() changes the ActiveWorkBook

$
0
0

I have created an application that does following things:

  1. Open workbook from path using Excel.Interop

     newwb = ExcelApp.Workbooks.Open(path,
                                         0,
                                         false,
                                         Type.Missing,
                                         Type.Missing,
                                         Type.Missing,
                                         true,
                                         Type.Missing,
                                         Type.Missing,
                                         true,
                                         false,
                                         Type.Missing,
                                         false,
                                         Type.Missing,
                                         Type.Missing);
     newwb.Activate();
    
  2. Set ScreenUpdating to false so that the user will not be aware of the active workbook.

  3. Performing some operations like Range.Cut() or Range.ClearContents() changes the active workbook back to "Book1"

I can set the active workbook back to newwb but that would be a performance overhead and I would like to know the exact reason that changes active workbook (But it doesn't trigger workbook changed event as well).

Any help or suggestion would be great.

Thanks.


Viewing all articles
Browse latest Browse all 88809

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>