Running a macro from an add-in

I have an add-in called book1. inside addin there is a module called module1 that has a sub called addin1

I would like to run addin1 macro from another book

I am trying to call this macro as follows:

Call Addin1

but it does not work

and I tried:

Call book1.xlam.Module1.AddIn1

which doesn't work either

Does anyone know how to run a macro that is inside an add-in?

+3
source share
5 answers

(Assuming Office 2007) Here is an example:

1- .
2- , MsgBox("Add-In")
3- xlam .
4- .
5- "" → Excel
6 - .
7- "" " Excel" "".
8 "" xlam.
9- , "".
10 - "" → Excel.
11 - "".
12- "" " ".
13- AddIn, .
14 - , .

+14

:

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

Public Sub ShowForm() 
    loginform.Show 
End Sub 
+5

, , :) ! , .

run "'book1'!module1"
+2

Jacob G answer - .xlam- , (.. ). .xlam- " "

+1

, (.xlam):

  • , VBA, , ( VBAProject) - , Addin_1.

  • VBA , , Addin_1. > , Addin_1 ( ).

  • , :

      Call Addin_1.routine_name(routine parameters)
    

Addin_1, Call Addin_1., , Call Addin_1.routine_name(, .

Tested with Excel 2013. Found when I was interested to know what happened when I installed the link to the VBA project of the installed add-in (.xlam). I have not seen this documented.

+1
source

Source: https://habr.com/ru/post/1745002/


All Articles