0
votes

I created an XLAM file which displays a customized ribbon tab, the buttons of which call various macros.

How do I get this add-in file to load automatically when opening another xlsm file?

Currently, the only way to display the add-in ribbon is to open the XLAM file first, then open the other XLSM file. Only then will the custom tab appear.

I appreciate your help.

Many thanks,

KS

2
Have you tried activating it through the Excel Options menu?Excellll

2 Answers

1
votes

In the ThisWorkbook module of the workbook (not the addin) enter something like this:

Private Sub Workbook_Activate()
Application.AddIns("MyAddin").Installed = True
End Sub

Private Sub Workbook_Deactivate()
Application.AddIns("MyAddin").Installed = False
End Sub

The word "Installed" is a bit misleading, as it only indicates whether the addin is checked or unchecked in the Addins Menu.

If by chance the ribbon is only for one workbook you should just attach the ribbon to that workbook.

If the ribbon is for multiple workbooks, people generally take the opposite approach to what you are doing, i.e., create an addin that uses application-level events to turn menus on or off when specific workbooks (or workbooks with a specific characteristics) are activated or deactivated.

0
votes

If you add the file to C:\Users[user]\AppData\Roaming\Microsoft\Excel\XLSTART it will add the ribbon every time you open Excel.