Run a macro within a macro without referencing the file name? Is it possible?

drew.j.harrison

Board Regular
Joined
Jul 9, 2010
Messages
65
So I want to make a macro which runs another macro within that file. Unfortunately when I record my actions I get the following:

Application.Run _
"'TiVCT Purchased Parts Matrix (03-09-11).xls'!Parts_Dropdown_Main"

It works just fine until I change the file name to reflect the current date. Is there anyway I can have it run a macro without having to reference the file name or refer to the current file? Any help is appreciated.
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Marc

Active Member
Joined
Feb 21, 2002
Messages
388
How about saving your macro in the Personal workbook, which you can have automatically open each time you open excel so that it will be available.

Then you could tweak your code with:

Application.Run "'PERSONAL.XLS'!Parts_Dropdown_Main"
 

drew.j.harrison

Board Regular
Joined
Jul 9, 2010
Messages
65
Anybody? There has to be some way I can do this short of copying the entire reference macro into the new macro (meaning I would have to update both anytime I decided to tweak them)
 

drew.j.harrison

Board Regular
Joined
Jul 9, 2010
Messages
65
How about saving your macro in the Personal workbook, which you can have automatically open each time you open excel so that it will be available.

Then you could tweak your code with:

Application.Run "'PERSONAL.XLS'!Parts_Dropdown_Main"


If I am reading this right you are suggesting I separate the macros from the file and house them in a separate file. That could work fine if I was the only one using this sheet but unfortunately I need to be able to to send it to others to use with working macros and I would prefer not to have to send them a separate macro file with it. Do I understand you correctly or am I missing something?
 

Forum statistics

Threads
1,141,734
Messages
5,708,171
Members
421,550
Latest member
Dtcfire

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
Top