views:

35

answers:

3

i have an add-in called book1. inside the addin there is a module called module1 which has a sub called addin1

i would like to run the macro addin1 from a different workbook

i am trying to call this macro like this:

Call Addin1

but that's not working

and i tried:

Call book1.xlam.Module1.AddIn1

which is not working either

does anyone know how to run a macro that is within an add-in ?

+2  A: 

I believe this is what your looking for :) You'll need all the single quotes and ! in the right places, can be a little tricky.

run "'book1'!module1"
Ommit
+1  A: 

In your workbook you write:

Sub test() 
    ' from other excel file
    Application.Run ("youraddin.xla!ShowForm") 
End Sub

And in the addin you have

Public Sub ShowForm() 
    loginform.Show 
End Sub 
nathanvda
+1  A: 

(Assuming Office 2007) Here's an example:

1- Open a new Workbook.
2- Add a macro that contains the code MsgBox("Add-In")
3- Save as xlam file.
4- Open new Workbook.
5- Click Office Button -> Excel Options
6- Click the Add-Ins tab on the left.
7- At the bottom, next to the "Manage" dropdown, select "Excel Add-Ins" and click Go.
8- Click Browse and navigate to your xlam file.
9- Ensure the box next to your file is checked and click Ok.
10- Click the Office Button -> Excel Options.
11- Click Customize Tab.
12- Select Macros in the "Choose Commands From Dropdown."
13- Double click your AddIn and now a button will appear on the Quick Access Toolbar.
14- Click the button and your message box will now show.

Jacob G