How to call a macro in a different file

D

DejaVu

I need to be able to call a macro that is located within another file.
It's no problem to call another macro that is within the same file, bu
as my project grows, it becomes too large and cumbersome. I need t
find some way to call a macro within another file.
Say, for example I have two workbooks (FileA and FileB). Within File
I have a macro (MacroA). At some point within that code, I need t
call a macro located in FileB named MacroB.

Is this possible?
Is it possible to do with VB Script?

TIA,
DejaV
 
C

Crowbar via OfficeKB.com

In the past I have created a custom toolbar and linked the macros from
another workbook to it, to perform actions
 
D

DejaVu

Thanks Crowbar... but I could not get your link to work.

I know how to have different buttons call macros from differen
workbooks, but while my code is executing, I need it to call a macr
from another workbook
 
T

Tom Ogilvy

assuming FileB.xls is open

application.Run "FileB.xls!MacroB"

see help on the Run command for details.
 

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