Interact with Ribbon without the Office Type Reference?

RobExcel

Board Regular
Joined
Jan 6, 2010
Messages
69
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):
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
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Forum statistics

Threads
1,214,863
Messages
6,121,978
Members
449,058
Latest member
oculus

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top