Pinaceous
Well-known Member
- Joined
- Jun 11, 2014
- Messages
- 957
- Office Version
-
- 365
- Platform
-
- Windows
Hi All;
I have a quick ? with a Macro w/in a Macro recorded code.
Let me try to explain it, here goes...
Below is a Macro that I recorded that containes several written Macros, as you can see.
My question is; when you rename the file(ie 'EXCEL-File-Name-2.xlsm'), it will not execute the command macro because the file name has since been changed.
Is there anyway around this, in terms of having a command macro, which containes a string of written macros for its a file name, where it is then copied and renamed to a different file name, where this command macro can still function w/o having to go into the VBA in order to change its name being; Application.Run "'Excel-File-Name-2.xlsm'!Macro##" ?
Hope my point is clear
.
Thanks in advance.
R/
-Pin
I have a quick ? with a Macro w/in a Macro recorded code.
Let me try to explain it, here goes...
Below is a Macro that I recorded that containes several written Macros, as you can see.
Sub Macro10()
'
' Macro10 Macro
'
' Keyboard Shortcut: Ctrl+Shift+Y
'
Application.Run "'Excel-File-Name-1.xlsm'!Macro12"
Application.Run "'Excel-File-Name-1.xlsm'!Macro1"
Application.Run "'Excel-File-Name-1.xlsm'!Macro8"
Application.Run "'Excel-File-Name-1.xlsm'!Macro9"
Application.Run "'Excel-File-Name-1.xlsm'!Macro4"
Application.Run "'Excel-File-Name-1.xlsm'!Macro13"
Application.Run "'Excel-File-Name-1.xlsm'!Macro5"
Application.Run "'Excel-File-Name-1.xlsm'!Macro6"
End Sub
My question is; when you rename the file(ie 'EXCEL-File-Name-2.xlsm'), it will not execute the command macro because the file name has since been changed.
Is there anyway around this, in terms of having a command macro, which containes a string of written macros for its a file name, where it is then copied and renamed to a different file name, where this command macro can still function w/o having to go into the VBA in order to change its name being; Application.Run "'Excel-File-Name-2.xlsm'!Macro##" ?
Hope my point is clear
Thanks in advance.
R/
-Pin