Calling a macro from another workbook in Excel
I have tried this over and over again and everytime it tells me
"Can
not run the macro 'Weekly Shrinkage Tool.xlsm!NewWeek'. The macro may not be
available is this workbook or all macros may be disabled."
I have tried
all sorts of versions of the line
Application.Run "MacroBook!MacroName"
including using a variable for the file name which I can't get to work at
all
but here are some ways I have typed it
Application.Run "Weekly
Shrinkage Tool.xlsm!NewWeek"
Application.Run "Weekly Shrinkage
Tool.xlsm!NewWeek()"
Application.Run "Weekly Shrinkage Tool.xlsm!Public Sub
NewWeek()"
Application.Run "Weekly Shrinkage Tool!NewWeek"
Am I
missing something like a simple syntax error?
Answer:
The short answer is Application.Run "MacroBook!MacroName"
Nevertheless, the called macro must be in a module not a
sheet.
You can find similar Excel Questions and Answer hereunder
1) I have a WorkBook that loads a form automatically when it is opened. In Excel, how can I suppress the form from loading on file open when required?
2) How do I disable the right click option for users in my WorkBook?
3) I have WorkBook with sensitive confidential information - how do I encrypt / protect my file so that access to file contents is restricted?
4) How can I make my macro wait for 5 secs before executing the next command?
5) How can I save a WorkSheet as a new WorkBook using VBA?
6) I frequently use a Macro - is there a way to quickly access the Macro in the Excel Ribbon?
7) I have a macro that takes a lot of time for execution - how can I keep the user informed that the macro is running?
8) How can I clear cell after activating a routine when there is a change in value of a cell?
9) Vlookup to return max value from multiple hits in Excel
10) Vba code to password protect workbook in Excel