• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • 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

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    Excel weirdness

    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?
    Never has a man been heard to say on his death bed that he wishes he'd spent more time in the office.

    #2
    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()

    Comment


      #3
      Originally posted by Scrag Meister View Post
      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.

      Comment

      Working...
      X