PDA

View Full Version : InvalidateControl in Excel not working... not sure what I'm doing wrong



mbrad
02-11-2023, 10:07 AM
Thank you for taking the time to read my question.
I have an EditBox in my ribbon that I want to clear after a button is clicked (also in the ribbon).
I have this at the top of my module:

Dim MyRibbon As IRibbonUI
Sub MyAddInInitialize(Ribbon As IRibbonUI)
Set MyRibbon = Ribbon
End Sub
And this is the code that I'm having issues with. When I click my button and call Sub CommandButton16 (or 17) I want the last thing it does to be clearing 2 EditBoxes. So far just trying to clear the one.... but I'm getting the error shown in the screen.
What am I doing wrong?

30529

30530


Above is the XML from Office RibbonX Editor pertaining to my buttons that do stuff, then I want them to clear the editBoxes after.
Thanks!

arnelgp
02-11-2023, 10:38 PM
MyRibbon should be declared as Public or Global:

Global MyRibbon As RibbonUI

Using Dim makes it Private (only visible within the Module it was created).