ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to call a sub from different file (https://www.excelbanter.com/excel-programming/293616-how-call-sub-different-file.html)

Norm[_5_]

How to call a sub from different file
 
Sorry for this basic question, I just can't seem to find
the answer in 'Help' ... imagine that!

I have a macro that takes over an hour to run. We'd like
to have a scheduler PC run this early in the morning.
Being on a scheduler, the macro cannot have any user
input. Also, I don't want to make it an autoexec macro
because the user might want to go into the file during the
day and NOT want the macro to run.

I'm thinking of having the scheduler PC execute a macro in
a different file that runs the big macro. But I'm having
trouble simply calling the macro from a different file.
Isn't it possible to run a macro in a different file?

Example: File1 contains Sub Test1() and File2 contains Sub
Test2(). Can't Test1 call Test2????

Thank You!

Bob Phillips[_6_]

How to call a sub from different file
 
Norm,

Yes it can, you just use application.run for example

Application.Run "file2.xls!test2"


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Norm" wrote in message
...
Sorry for this basic question, I just can't seem to find
the answer in 'Help' ... imagine that!

I have a macro that takes over an hour to run. We'd like
to have a scheduler PC run this early in the morning.
Being on a scheduler, the macro cannot have any user
input. Also, I don't want to make it an autoexec macro
because the user might want to go into the file during the
day and NOT want the macro to run.

I'm thinking of having the scheduler PC execute a macro in
a different file that runs the big macro. But I'm having
trouble simply calling the macro from a different file.
Isn't it possible to run a macro in a different file?

Example: File1 contains Sub Test1() and File2 contains Sub
Test2(). Can't Test1 call Test2????

Thank You!





All times are GMT +1. The time now is 12:09 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com