Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Calling an XLA macro from code
How do I call an XLA macro from the code in another workbook?
Chrissy. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Calling an XLA macro from code
Step1:
make sure the CALLED procedures: are NOT private. are NOT located in object modules (like thisworkbook or Sheet1) are NOT located in module with OPTION PRIVATE MODULE THEN EITHER use the RUN method to run the macro. OR make a fixed reference to it: in the VBE: give the Addin's VBAProject a meaningfull name. by clicking on it in the ProjExplorer and Changing it's name in the Properties window. E.g. TESTADDIN THEN in the VBE Tools/References Checkmark the XXX.xla in the list then close. this way you can call the procedures and you'll find the procedures in the object browser with the linking workbook active. EXAMPLES: 'CODE FOR CALLER.xls SHEET1 object module Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) 'This works when the book has a REFERENCE to TESTaddin Call showmsg(Target.Address) End Sub Private Sub Worksheet_SelectionChange(ByVal Target As Range) Run "test.xla!showmsg", Target.Address End Sub 'CODE FOR TEST.XLA Module1 Sub ShowMsg(sMsg As String) MsgBox sMsg End Sub HTH :) keepITcool < email : keepitcool chello nl (with @ and .) < homepage: http://members.chello.nl/keepitcool "Chrissy" wrote: How do I call an XLA macro from the code in another workbook? Chrissy. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Calling an XLA macro from code
Just to add...
Application.Run "Addin.xla!Mcr" or if there are spaces in the book name: Application.Run "'Addin 2.xla'!Mcr" or if apostrophes/spaces: Application.Run "'" & Replace("Addin's.xla", "'", "''") & "'!Mcr" "Chrissy" wrote in message ... How do I call an XLA macro from the code in another workbook? Chrissy. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Calling VBA code from html or javascript | Excel Discussion (Misc queries) | |||
Calling a bit of code from a sheet errors | Excel Discussion (Misc queries) | |||
calling a macro from within a loop | Excel Programming | |||
Calling macro in add-in. | Excel Programming | |||
Calling HTML Source code from within VBA for Excel | Excel Programming |