AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Excel vba debugging11/11/2023 Next up on the debugging mission was to step through the code, at which point I discovered that I had no reference to the RibbonUI object. After checking the XML I was pretty sure it wasn't, but just for grins I switched to try to Invalidate the entire ribbon. This was irritating, but I've debugged a lot of RibbonX before, so I thought it may be the control name. This particular problem started for me when my InvalidateControl methods weren't working. 'Set the RibbonUI to a workbook property for later useĪt that point I can invalidate the entire ribbon by using: Private Sub rxIRibbonUI_OnLoad(ribbon As IRibbonUI) Public Property Get ribbonUI () As IRibbonUIĪnd then the onLoad statement, placed in a standard module, looks like this: Public Property Let ribbonUI (iRib As IRibbonUI ) The following code goes in the ThisWorkbook class module: I always use a custom property to contain my RibbonUI object. in combination with Locals and Immediate windows.I ran into this the other day when I was working on a file and it drove me nuts. In addition, you can simply edit any watch items in the list by double clicking. You can add all of these options in the "Add watch" dialog, which you either get by right clicking on any variable (or other code) in the code module - or by right clicking in the watch window: if you set a watch to myVar=0 and active Break When Value Is True, the code will automatically stop the moment the potential bug is "initiated" Even a breakpoint when the value changes or results in True - this is quite handy when debugging, as it allows you quick conditional breakpoints without adding additional code, e.g.You can activate it in the View menu -> Watch window: In addition to the Immediate window (as described in the other answer), the Watch window is very helpful in those circumstances.
0 Comments
Read More
Leave a Reply. |