I have a custom ribbon which works fine but I only want to enable it and have my add in show for certain workbooks so I check for the workbook title on load and try to use the Invalidate method if the condition is false. Unfortunately nothing happens the custom ribbon tab is still showing.
The following is my sub:
Public Sub loadMyRibbon(ribbon As IRibbonUI)
Set RibUI = ribbon
If Not workbookTitle = "My Workbook" Then
If Not RibUI Is Nothing
RibUI.Invalidate
MsgBox "Not Working"
End If
End If
End Sub
Which seems correct to me from reading through the method documentation: Microsoft Documentation
I see my MsgBox message displayed on the screen so I know the code is executing correctly up to that point but RibUI.Invalidate doesn't hide my tab. Appreciate any pointers!
I have also tried:
RibUI.InvalidateControl "myTag"
But this also doesn't work