Link to home
Start Free TrialLog in
Avatar of Roger
RogerFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Excel customised ribbon - unexplained deletion of macro called from xml: button onAction

I made a new excel fluent ribbon via the Custom UI Editor for Microsoft Office.
This line of xml occurred in a conventional  tab and group xml segment:

<button id="Tab1Gp1_2" label="FILE path" tag="2" getEnabled="GetEnabled" onAction="file"/>  

But when I saved the the xml, and re-opened the .xlsm file,  the onAction macro file was deleted from the standard module within which it was written (the same module that contained:
Sub RibbonOnLoad(ribbon As IRibbonUI) etc.

No other subs were deleted, and the code ran OK in other versions of the file:

Sub file(control As IRibbonControl)
    RefreshRibbon (4)    'tag for next button to be enabled
    MsgBox "file.id = " & control.ID
End Sub

When I re-entered the macro, it was again deleted.
When I ran these elements in a different excel file and xml, the onAction call worked perfectly.

My next move is to re-build the xml and excel bas files in a new .xlms file.

I have this experience from time to time. Has anyone else had it?
Do you have an explanation, a means of avoiding it, or a means of repairing the file?

thanks
Kelvin
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Change the name from "file" to something else????
ASKER CERTIFIED SOLUTION
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Roger

ASKER

Thank you for a new technique: Debug>Compile VBAProject.
Unless you have further comment; I'm happy to sign off.
If you are interested in learning about debugging you could read my article on the subject.

In any case you’re welcome and I’m glad I was able to help.

If you expand the “Full Biography” section of my profile you’ll find links to some other articles I’ve written that may interest you.

Marty - Microsoft MVP 2009 to 2017
              Experts Exchange MVE 2015
              Experts Exchange Top Expert Visual Basic Classic 2012 to 2017