ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Assigning Macro in another workbook (https://www.excelbanter.com/excel-programming/286442-assigning-macro-another-workbook.html)

Todd Huttenstine[_2_]

Assigning Macro in another workbook
 
Hey

The below part of my code assigns the macro "ImportData"
to my menu item that I have created. I would like for it
to assign that macro "ImportData" but the macro is loacted
in Workbook ImportData. What is the code to make it
assign this macro from that workbook?


ctrlButton.OnAction = "ImportData"

Thank you

Todd Htutenstine

Dave Peterson[_3_]

Assigning Macro in another workbook
 
If the ImportData Workbook is closed:

..OnAction = "c:\my documents\excel\Importdata.xls" & "!module1.importdata"

(the module1. stuff is only required if you have non-unique procedure names in
different modules.)

and if it's open:
..OnAction = "importdata.xls!module1.importdata"



Todd Huttenstine wrote:

Hey

The below part of my code assigns the macro "ImportData"
to my menu item that I have created. I would like for it
to assign that macro "ImportData" but the macro is loacted
in Workbook ImportData. What is the code to make it
assign this macro from that workbook?

ctrlButton.OnAction = "ImportData"

Thank you

Todd Htutenstine


--

Dave Peterson



All times are GMT +1. The time now is 01:36 PM.

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