This is important because if you are editing your VBA code while testing your add-in, your public variable (myRibbon) will lose its value and you will not be able to refresh the Ribbon UI until you restart Excel (very annoying!). In this code, we are also saving a unique ID that points to the ribbon object to a named range within the add-in file called RibbonID. This code will store the Ribbon object to a public variable called myRibbon. This first subroutine is the macro the add-in calls via the XML code upon the RibbonLoad event (when the add-in’s Ribbon UI is first loaded after launching in Excel). Note, this code works for both 32-bit and 64-bit Excel (hence the constant testing for VBA7) VBA Code: The below code will show you how to properly store your add-ins ribbon object and reload it whenever your call the macro “ RefreshRibbon”. There may be times when you need to refresh the user interface (UI) of your custom Excel add-in after Excel launches your add-in.
0 Comments
Leave a Reply. |