How to update Excel during debugging

If I am debugging (in this case, the Visual Studio assembly called by Excel) and the code updates the Excel worksheet, how can I get Excel to redraw the current sheet / window while pausing in the debugger?

+3
source share
1 answer

If you invoke the Excel cross-process (for example, through automation), Excel should automatically show any changes when making calls, if you do not install xlApp.ScreenUpdating = False. If so, then it is probably best to use a conditional condition so as not to set xlApp.ScreenUpdating = Falseif it is running in debug mode when you have breakpoints set. Otherwise, you will have to install xlApp.ScreenUpdating = Truefrom some other process (using GetObject()or something similar so that you can capture the same instance of the Excel application).

, (, ), " ", CommandBar, . Excel , Excel. , , " ", xlApp.ScreenUpdating = True, . ( !)

xlApp.ScreenUpdating = False, , , ...

+2

Source: https://habr.com/ru/post/1698742/


All Articles