Jamie Garroch - MVP
Jamie Garroch - MVP

Reputation: 2979

Ribbon Invalidate doesn't work in Excel 2007 when loaded as a VBA .xlam

This is a weird head scratching one!

I have a cross-MSO add-in written in VBA that uses the same XML definition, ribbon controls and VBA callback procedures. It's working for PowerPoint 2007, 2010 & 2013 (x32 & x64), Excel 2010 & 2013 (x32 & x64).

But, it only works in Excel 2007 when loaded as the source .xlsm

When saved and loaded as an .xlam (either using the registry OPENX method or copying the .xlam to the XLSTART folder) it fails.

The failure occurs when I call a procedure to invalidate the ribbonUI object so that a gallery control (with buttons below it) are refreshed in accordance with images/states in their respective callback procedures. I checked that the reference to the ribbon object hasn't been lost but invoking the invalidate method doesn't cause the ribbon controls to call their respective callback procedures and hence they aren't refreshed.

I have tried working around the issue by adding the following element to the gallery definition in the 2007 XML part and while that does resolve the image item refreshing, the buttons still don't call the callback procedures.

invalidateContentOnDrop="true"

I haven't posted any code as I'm not sure which bit would help diagnose this odd behaviour but can do so on request!

Any ideas?

Upvotes: 2

Views: 1567

Answers (1)

Jamie Garroch - MVP
Jamie Garroch - MVP

Reputation: 2979

Doh.

This is now resolved after a whole day to discover the blindingly obvious!!!

The problem was that I had another addin already installed that used the same onLoadRibbon signature in the XML/VBA codes so there was crosstalk between the addins and that messed everything up! What I don't understand is why it affected 2007 and 2010 (tested later) but 2013 didn't demonstrate the issue.

Anyway, I have now changed the respective signatures and XML code in both addins as follows:

Add-In 1

XML:

<customUI onLoad="app1LoadRibbon" xmlns="http://schemas.microsoft.com/office/2009/07/customui">

VBA:

Public Sub app1LoadRibbon(ByVal ribbonUI As IRibbonUI)

Add-In 2

XML:

<customUI onLoad="app2LoadRibbon" xmlns="http://schemas.microsoft.com/office/2009/07/customui">

VBA:

Public Sub app2LoadRibbon(ByVal ribbonUI As IRibbonUI)

Upvotes: 2

Related Questions