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

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
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
 
Upvote 0
Solution
Thanks for posting your solution. :)
 
Upvote 0

Forum statistics

Threads
1,214,611
Messages
6,120,509
Members
448,967
Latest member
screechyboy79

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
Back
Top