Forum Discussion
When creating a button in the ribbon it's calling macro location. Best way to remove and manage?
I've created a few different ribbons calling various macro's.
The ribbon and the excel add-in that has the code for the macros will be sent to different users to install. However prior to sending this out I have to manually edit the ribbon in VSC Code to remove the "PATH" reference to the macro location this attribute onAction="PATH!runValidation". Is there a better way to manage this when exporting the ribbon?
I've also created multiple ribbons/macro's for different groups of users. Is there a better way to manage multiple ribbons? On install it clears out all except the original excel tabs. So if I have to go back and update a ribbon for a different group it installs over the last one I was working on and vice versa.
2 Replies
- Zack BarresseIron Contributor
aabarreda to confirm, your add-in is calling routines in other workbooks? I would handle it all in VBA as opposed to ribbon callbacks. Set your onAction to call a routine located in the add-in itself. Then, in your VBA callback, set what you want to do there.
For multiple ribbons I would recommend using a shared namespace, but it's a little unclear as to the entire hierarchy of your ribbons and how they relate and are consumed by your users. Assuming for the moment that all of your add-ins, used by multiple users, are of the same framework/usage, a namespace would collect them all under a single banner. For example, you could have multiple add-ins utilizing the same ribbon tab, with groups appearing only for those installed add-ins.
Here is an example of a ribbon xml utilizing a shared namespace. When creating add-in ribbons, you can use it as a template, keeping the 'nmNameHere' (namespace name) the same across all add-in custom ribbons. This will ensure they utilize the same ribbon tab, although you can structure it any way you want.
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" xmlns:nmNameHere="A name for your namespace"> <ribbon> <tab idQ="nmNameHere:YourTabNameHere" label="Label Text Here"> <group idQ="nmNameHere:grpExport" label="Your Label" autoScale="false" imageMso="ImageMSOHere" insertBeforeQ="nmNameHere:GroupNameHere" > <!-- Your button commands go here --> </group> </tab> </ribbon> </customUI>- aabarredaCopper Contributor
Zack Barresse Appreciate the reply.
Now that I've written out I think the issue is I'm creating the ribbon before I've created the excel add in file and installed it. So at that point in time the vba only exists in my local workbook.
This would solve my problems will look into this. "For example, you could have multiple add-ins utilizing the same ribbon tab, with groups appearing only for those installed add-ins."
Thanks so much.
-Alberto