Macro Names

MSGray

New Member
Joined
Aug 12, 2015
Messages
12
I have completed a workbook with several macros working well inside. The problem is that when I change the name of the actual excel file, none of the macros will work because they have the file name in the beginning of the macro name. This workbook is for budgets and will be saved down multiple time as different versions and I need each version to work. Help... Is there an easy way to rename them to the current name in the back ground each time the file name has been changed?
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Welcome to the board,

How are you calling the macros ? Are you using the Call statement or the Application.Run Method ? Are Macros on different modules having the same name ?
 
Upvote 0
Welcome to the board,

How are you calling the macros ? Are you using the Call statement or the Application.Run Method ? Are Macros on different modules having the same name ?

Each macro is assigned to a form control button. I'm sorry but I'm fairly new at all this and I'm not sure what you mean by different Modules. Each form control button is assigned a different macro. For example: If I create a quick macro to protect the sheet and call it "Protect", the actual file name is now "Master Budget/Protect". Now if I need to change the name of the file from Master Budget to Master Budget 2, I get an error message when I use one of the form control button saying it cant find the assigned macro.
 
Upvote 0
MSGray,

Welcome to the MrExcel forum.

1. What version of Excel, and, Windows are you using?

2. Are you using a PC or a Mac?


In order to assist you it would help us if you posted all of your macro code using code tags.

When posting VBA code, please use Code Tags - like this:

[code=rich]

'Paste your code here.

[/code]
 
Upvote 0
Code:
    Application.Run "'MSTR DD List.xlsm'!unprotect"
    Application.Run "'MSTR DD List.xlsm'!unprotect"
    Sheets("Section 1").Select

I think what its doing is using another macro inside of this macro.
 
Upvote 0
MSGray,

Please answer the following two questions:

1. What version of Excel, and, Windows are you using?

2. Are you using a PC or a Mac?


And, please post ALL of your macro(s) code(s):

When posting VBA code, please use Code Tags - like this:

[code=rich]

'Paste your code here.

[/code]
 
Upvote 0

Forum statistics

Threads
1,216,099
Messages
6,128,816
Members
449,469
Latest member
Kingwi11y

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