MiniMite
MiniMite

Reputation: 76

How to open add-in automatically on opening excel workbook

I want to know how I can have a workbook automatically open an add-in? The problem is after I create the workbook in code -- call it "A.xlsx" -- I want to add code to it (on creation) that will open the Excel add-in "B.xlam". How do I do this? Creating the workbook is no problem; that part is sorted, and I just want to add the code to that workbook, so that every time it opens it must open the add-in "B.xlam" with it.

Upvotes: 1

Views: 13805

Answers (1)

David Zemens
David Zemens

Reputation: 53663

From the Developer Ribbon, click Add-Ins,

enter image description here

then click Browse, then navigate to the location of the desired add-in file, then select it, and make sure the checkbox is selected for it.

enter image description here

Alternatively, store the code in PERSONAL.XLS/PERSONAL.XLSB, and these macros/functions will be available to all open workbooks.

If you're somehow asking how to programmatically insert code in to new workbook files, I'm afraid you're out of your element. If you don't know about the Workbook_Open event, nor how to manage your Add-Ins, etc., manipulating the VBE is a pretty high-level operation, and I would not be able to help you with that.

Update from comments

Here is one method that will export VB Components to a specific path, example also includes code to import modules from path to a workbook. You should be able to adapt this to your purposes.

http://www.rondebruin.nl/win/s9/win002.htm

If you have specific problems implementing this solution, please post as a new question.

Upvotes: 1

Related Questions