ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Calling excel macro not located in that workbook. (https://www.excelbanter.com/excel-programming/408667-calling-excel-macro-not-located-workbook.html)

cr113

Calling excel macro not located in that workbook.
 

Can I call an excel macro programmatically from another workbook in
Excel 2003?

For example suppose I have 2 workbooks, book1.xls and book2.xls:


book1.xls
module1
macro1

book2.xls
module2
macro2

How would I call book2.module2.macro2 from book1.module1.macro1?

Ron de Bruin

Calling excel macro not located in that workbook.
 
Hi cr113

You can use Application.run

Application.Run "YourFile.xls!YourMacro"

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"cr113" wrote in message ...

Can I call an excel macro programmatically from another workbook in
Excel 2003?

For example suppose I have 2 workbooks, book1.xls and book2.xls:


book1.xls
module1
macro1

book2.xls
module2
macro2

How would I call book2.module2.macro2 from book1.module1.macro1?


cr113

Calling excel macro not located in that workbook.
 
On Apr 1, 4:15*pm, "Ron de Bruin" wrote:
Hi cr113

You can use Application.run

Application.Run "YourFile.xls!YourMacro"

--

Regards Ron de Bruinhttp://www.rondebruin.nl/tips.htm



"cr113" wrote in ...

Can I call an excel macro programmatically from another workbook in
Excel 2003?


For example suppose I have 2 workbooks, book1.xls and book2.xls:


book1.xls
* *module1
* * * *macro1


book2.xls
* *module2
* * * *macro2


How would I call book2.module2.macro2 from book1.module1.macro1?- Hide quoted text -


- Show quoted text -


I had to do a workbooks.open "book2" first, but it worked.

Thanks!


All times are GMT +1. The time now is 04:30 AM.

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