Path issue using a macro on the ribbon
I have created several macros which I use every day. I have added these to the ribbon as buttons and they work fine.
The spreadsheet is for daily finances and I typically save a new copy each day with the current date. So say I add the macros in a file called May-26.xlsm and tomorrow I save this as May-27.xlsm.
The problem is that when I try to invoke the macros in May-27.xlsm it has stored the name of the original spreadsheet for each button in the ribbon, so it loads May-26.xlsm in the background (it is visible).
I have tried storing the macros in my personal.xlsb file in my profile and if I do this they simply do not run from the ribbon.
I can run the macros no problem using shortcuts or from the Macro command. I can even add buttons to the Quick Launch toolbar and these work correctly without loading the original spreadsheet.
The issue appears to be that the act of adding the macros to the ribbon as buttons stores a hard-coded link to the name of the current spreadsheet along with the macro and that subsequently renaming the spreadsheet does not update this hard-coding.
Is there a way to prevent this and make the ribbon commands refer to macros in the current spreadsheet?
|