Running macros from another workbook

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
 
J

John Green

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?
 
B

Bob Flanagan

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
 
L

lance-news

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
 
J

John Green

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top