I'm using the Office Fluent Ribbon object model in a workbook that I've had issues with 'objects disconnecting from their clients'.
The Microsoft solution (http://support.microsoft.com/default.aspx?scid=kb;en-us;Q319832) involves removing the Office Type Reference (Microsoft Office 12.0 Object Library) and then adjusting your declarations etc. I've done all that and have no errors on compiling.
However, now that I've removed the Office Type Reference, I'm having trouble making my VBA code interact with the Ribbon. All I'm trying to do is Invalidate the ribbon or a control on the ribbon, but it seems that the reference is required for that. Does anyone have a workaround?
My code follows (this works when I have the Reference added and declare the ribbon variable as an IRibbonUI):
The error I'm getting is runtime '424' Object Required on the Invalidate code line. It seems to be related to declaring SMARTribbon as an Object instead of as an IRibbonUI...
Thanks
Rob
The Microsoft solution (http://support.microsoft.com/default.aspx?scid=kb;en-us;Q319832) involves removing the Office Type Reference (Microsoft Office 12.0 Object Library) and then adjusting your declarations etc. I've done all that and have no errors on compiling.
However, now that I've removed the Office Type Reference, I'm having trouble making my VBA code interact with the Ribbon. All I'm trying to do is Invalidate the ribbon or a control on the ribbon, but it seems that the reference is required for that. Does anyone have a workaround?
My code follows (this works when I have the Reference added and declare the ribbon variable as an IRibbonUI):
Code:
Option Explicit
Public SMARTribbon As Object
'Public SMARTribbon As IRibbonUI 'used prior to removing reference
'Callback for customUI.****** - to make this subroutine run, you need to add the ****** command back into the ribbon xml
Sub ribb******ed(ribbon As Object)
Set SMARTribbon = ribbon
End Sub
Sub MyInvalidate()
SMARTribbon.Invalidate
End Sub
The error I'm getting is runtime '424' Object Required on the Invalidate code line. It seems to be related to declaring SMARTribbon as an Object instead of as an IRibbonUI...
Thanks
Rob