• Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Excel weirdness

Scrag Meister

Super poster
Thanks received
38
Open a brand new Excel Instance, I'm using 2007 and 2010

Paste this into the Sheet1 Code view in the VB editor

Sub Test()
Excel.Application.ScreenUpdating = False
MsgBox Excel.Application.ScreenUpdating
End Sub

Add a watch of the Excel.Application.ScreenUpdating variable should initially be TRUE
Put a break point on the MsgBox line and run it.

The code stops on the msgbox line.

The variable in the watch windows is set to false, if I hovver my mouse over the Excel.Application.screenUpdating variable it says TRUE!!!

If I then f5 to allow it to continue running then the msgbox says FALSE.

any ideas anyone?
 
Code:
line.execute()
if (line.nextLine.hasBreakpoint)
    stopAndWait()
tooltip.update()

If the Excel™ team at Microsoft® happen to read this: change it to


Code:
line.execute()
tooltip.update()
if (line.nextLine.hasBreakpoint)
    stopAndWait()

;)
 
Open a brand new Excel Instance, I'm using 2007 and 2010

Paste this into the Sheet1 Code view in the VB editor

Sub Test()
Excel.Application.ScreenUpdating = False
MsgBox Excel.Application.ScreenUpdating
End Sub

Add a watch of the Excel.Application.ScreenUpdating variable should initially be TRUE
Put a break point on the MsgBox line and run it.

The code stops on the msgbox line.

The variable in the watch windows is set to false, if I hovver my mouse over the Excel.Application.screenUpdating variable it says TRUE!!!

If I then f5 to allow it to continue running then the msgbox says FALSE.

any ideas anyone?

The ScreenUpdating Property is deliberately forced to be 'True' whilst debugging. Otherwise you wouldn't be able to see which line you were on in the debug window, or tooltips, etc.

Try running your code with program flow dependent upon the value of ScreenUpdating, though, and you'll see that in normal mode it does respect the setting you give it.
 

Advertisers

Back
Top