ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   execute macro in other workbook (https://www.excelbanter.com/excel-programming/337900-execute-macro-other-workbook.html)

Sylvain

execute macro in other workbook
 
Hi !

I can't find for the moment the VBA code to execute the sequence :
- open a workbook
- execute a macro stored in it

Thank you for your help

Best regards

Sylvain caillet



Norman Jones

execute macro in other workbook
 
Hi Sylvain,

Try:

Application.Run "MyBook.xls!MyMacro"

If MyBook is not in the default directory, include the full path.

This will open MyFile.xls (if it is not open) and run its MyMacro routine.


---
Regards,
Norman



"Sylvain" wrote in message
...
Hi !

I can't find for the moment the VBA code to execute the sequence :
- open a workbook
- execute a macro stored in it

Thank you for your help

Best regards

Sylvain caillet




Sylvain

execute macro in other workbook
 
Post cancelled. Sorry

Sylvain
"Sylvain" a écrit dans le message de news:
...
Hi !

I can't find for the moment the VBA code to execute the sequence :
- open a workbook
- execute a macro stored in it

Thank you for your help

Best regards

Sylvain caillet




Bob Phillips[_6_]

execute macro in other workbook
 
Workbooks.Open Filename:=wb_filename
Application.Run "'" & Activeworkbook.Name & "'!myMacro"

If the code is added to the workbook's Workbook_Open event, it will execute
automatically upon opening the workbook.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Sylvain" wrote in message
...
Hi !

I can't find for the moment the VBA code to execute the sequence :
- open a workbook
- execute a macro stored in it

Thank you for your help

Best regards

Sylvain caillet






All times are GMT +1. The time now is 12:26 PM.

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