c# - Writing to a cell turns on ScreenUpdating in my VSTO add-in -


i have weird problem excel behaving differently on development machine , testing machine.

in add-in, i've turned off screenupdating in several places long running processes. on machine works fine. on testing machine, excel sets screenupdating = true write cell.

the following code demonstrates issue me.

private void thisaddin_startup(object sender, system.eventargs e) {     microsoft.office.interop.excel.application excel = globals.thisaddin.application;      messagebox.show(excel.screenupdating.tostring());      excel.screenupdating = false;     messagebox.show(excel.screenupdating.tostring());      workbook workbook = globals.thisaddin.application.activeworkbook;     worksheet w = (worksheet)workbook.worksheets[1];     ((range)w.cells[1, 1]).value = "test";     messagebox.show(excel.screenupdating.tostring()); } 

on machine, opening excel gives 3 message boxes saying

"true", "false", "false".

on test machine say

"true", "false" , "true".

i've stepped through remote debugger , watched screenupdating property change after cell value set. further, isn't thing resets screenupdating. adding or removing worksheet or workbook this.

the excel version on each system same (14.0.6112.5000 (32-bit)).

what causing this? how can fix excel respects settings?

other addins in excel can interfere single global setting.

it reason supposed save current screenupdating state local variable before, , restore after, each use.

ignore changing of setting in thisaddin_startup event (as not work there anyway).


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -