Running macros from another workbook

  • Thread starter Thread starter lance-news
  • Start date Start date
L

lance-news

I have a workbook called macros.xlm that is a hidden workbook that
I always open when Excel is opened.

If I have another workbook open (say Test.xls) and I create a macro
sub test()

End sub


How do I call a macro from macros.xlm from Test.xls?



I have tried:

sub test()
Run Macros.xlm!A0FormatMeans
End sub

and a few other things but just cannot figure it out.

Lance
 
Lance,

The argument to Run should be text.

Run "Macros.xlm!A0FormatMeans"

Having said that, the .xlm extension has me worried. Are you running Excel 4 macros?
 
Try

Application.Run "macros.xlm!macroname"

You can also use the recorder to get the above.

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel
 
No, I am running Office XP. Should I rename Macros.xlm to Macros.xls?
Everything seems to have run fine up to this point.

My quick fix to this problem is to simply copy the macros I need from
Macros.xlm into the workbook I am currently using.

Lance
 
There's nothing wrong with using .xlm and it would even work with Excel 4 macros.

I was just intrigued that you were using an old extension.
 
Back
Top