You are here:

Excel/Set reference to add-in VBA


QUESTION: Pearson Software Consulting wrote: 6-October-2007  

To load or unload an Add-In using VBA code, use
       Application.AddIns("AddIn Displayed Name").Installed = True
VBA Tips: How to Use Your Excel Add-In Functions in VBA
further wrote

The first thing to do is give your Add-In a unique VBA Project Name.

I made an addin with filename t.xlam
VBA project name "ct"

I can see them in Add in dialog boxes.
I can make it work manually tick them but not through code.

I tried


a = Application.AddIns.Count
For i = 1 To a
Debug.Print AddIns(i).Name
If AddIns(i).Name = "t.xlam" Then Application.AddIns(i).Installed = True

All failed.

Can you advise what I must do please?


ANSWER: Hi Cheung,

Perhaps this article helps:

---------- FOLLOW-UP ----------

QUESTION: Thank you for your advice.

I read from your article the addin MUST be in the default library location. I can manually add it in, but programmatically I got err 75. I am investigating.


No, not necessarily. An add-in can be in ANY folder.

I use code like this to let an add-in install itself:

In a normal module:

Public Sub CheckInstall()
   Dim oAddIn As AddIn
   If Not IsInstalled Then
       If MsgBox("Do you wish to install '" & ThisWorkbook.Name & "' as an addin?", vbQuestion + vbYesNo, "Install Add-in?") = vbYes Then
         'This adds the add-in to the list of add-ins:
         Set oAddIn = Application.AddIns.Add(ThisWorkbook.FullName, False)
         'This checks the add-in in that list (and hence "installs" it):
         oAddIn.Installed = True
       End If
   End If
End Sub

Public Function IsInstalled() As Boolean
   Dim oAddIn As AddIn
   If ThisWorkbook.IsAddin Then
       For Each oAddIn In Application.AddIns
         If LCase(oAddIn.FullName) = LCase(ThisWorkbook.FullName) Then
         If oAddIn.Installed Then
         IsInstalled = True
         Exit Function
         End If
         End If
       IsInstalled = True
   End If
End Function

In ThisWorkbook:

Private Sub Workbook_Open()
ENd Sub
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts


Jan Karel Pieterse


Excel and Excel/VBA questions


Excel MVP

Self employed Excel developer

Bachelor in Chemical Engineering

Awards and Honors
Microsoft MVP award since 2002

Past/Present Clients
Shell, Fortis bank, ABN-AMRO bank, Morgan Stanley, ...

©2016 All rights reserved.