Excel VBA add-ins.add

rmwitt

New Member
Joined
Sep 21, 2021
Messages
8
Office Version
  1. 2019
Platform
  1. Windows
to add a new add-in to the add-in menu (developer tab>add-ins), i execute the following:

Private Sub Workbook_Open()
Dim newAi As AddIn

Set newAi = Application.AddIns.Add(fileName:=ThisWorkbook.FullName, copyfile:=True)

this does not work for *.xlam files; however, this does work for *.xlsm files.

I have set trusted locations, and enabled the trust vba project check box.

has anyone experienced this? any solutions?
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

rmwitt

New Member
Joined
Sep 21, 2021
Messages
8
Office Version
  1. 2019
Platform
  1. Windows
i am using excel 2019; windows 10
 

rmwitt

New Member
Joined
Sep 21, 2021
Messages
8
Office Version
  1. 2019
Platform
  1. Windows
wow....after many hours of searching, i found the (a) answer. The reason why xlsm files work and xlam do not work, is because the xlsm file is open when the command, above, is executed. The xlam file is closed. To prove, try adding/installing the xlam manually, with no workbooks open...can't do it. So, there are two solutions:
1. open a blank (or any workbook), then execute 'set newAI = Application.AddIns.Add(fileName:=ThisWorkbook.FullName, copyfile:=True)' or better yet...
2. execute the line 'newAI.isaddin = false'. This will display the 'workbook page' associated with the addin. Then execute 'set newAI = ...' Depending on your application, you will only need to reset the flag 'newAI.isaddin = True', if you are still using the same addin for future use(rs) from which the code is executing. In my case, i copied the addin to another addin file, and the flag 'newAI.isaddin = True' is already set.

hopefully, my explanation makes sense; otherwise, please let me know.

voila!

thanks to Dr. K Solved: Can't get my XLA auto installer to work... [Archive] - VBA Express Forum
 
Solution

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
37,828
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
Thanks for posting your solution. :)
 

Forum statistics

Threads
1,148,327
Messages
5,746,128
Members
423,994
Latest member
blzxatly

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top