Trouble calling VBA macro from custom ribbon tab in Excel 2010

fluorophore

New Member
Joined
Mar 27, 2013
Messages
3
I have four macros I would like to call within Excel 2010. They all run fine when called using a command button. In order to have accessing them more convenient (in any worksheet), I wanted to create a custom ribbon tab that has buttons to run each. This also works fine, however I need to have this functionality available to anyone that I send the spreadsheet to.

If I export the ribbon information using "export all customizations," which creates a *.exportedUI file, and then import this on a different machine, the ribbon appears fine, however clicking on one of the macro buttons in the ribbon gives the error:

Cannot run the macro "C:\Users\ ... \filename.xlsm'!macro1'. The macro may not be available in this workbook or all macros may be disabled.
<c:\users...\filename.xlsm'!macro1'. the="" macro="" may="" not="" be="" available="" in="" this="" workbook="" or="" all="" macros="" disabled.


The reason why it's not working is clear: this isn't the path of the current file. For whatever reason, the macro path it tries to access is that of the original file when the ribbon was first created and exported.

It seems odd that the default is to specify the macro location to be the original path rather to just point to wherever the current file resides (since the macros are already embedded there). I have no idea how to fix this, but it should be simple.

I've searched a fair amount on this topic, and there are solutions out there, but I don't see how to apply them to my situation. For example, someone suggests adding this code fixes it:

Code:
[COLOR=#333333]Application.Run "'" & Application.ActiveWorkbook.Name & "'!NamShortList"[/COLOR]

The trouble is that this would have to be in a location where the macro is called, and that only occurs in the ribbon. I don't call macros from within VBA code.</c:\users...\filename.xlsm'!macro1'.>
 
Last edited:

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
It would be simpler to create the custom tab yourself in the workbook's customui component - see Ron's page here for samples and information.
 
Upvote 0
Well the only other option I can think of would be to edit the .exportedUI file in Notepad or similar and remove all the path information.
 
Upvote 0
Well the only other option I can think of would be to edit the .exportedUI file in Notepad or similar and remove all the path information.
I think this worked. Great advice, thanks!

If it proves not to work for all cases, I'll have to explore the CustomUI option above.

Thanks for your help, Rory.
 
Upvote 0
You're welcome. :)

Using XML in the Ribbon is really not as bad as it may appear at first glance.
 
Upvote 0

Forum statistics

Threads
1,214,406
Messages
6,119,330
Members
448,888
Latest member
Arle8907

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