AddIns Collection Object

Microsoft Excel Visual Basic

ApplicationAddIns
AddIn

A collection of AddIn objects that represents all the add-ins available to Microsoft Excel, regardless of whether they’re installed. This list corresponds to the list of add-ins displayed in the Add-Ins dialog box (Tools menu).

Using the Addins Collection

Use the AddIns method to return the AddIns collection. The following example creates a list that contains the names and installed states of all the available add-ins.

Sub DisplayAddIns()
    Worksheets("Sheet1").Activate
    rw = 1
    For Each ad In Application.AddIns
        Worksheets("Sheet1").Cells(rw, 1) = ad.Name
        Worksheets("Sheet1").Cells(rw, 2) = ad.Installed
        rw = rw + 1
    Next
End Sub
		

Use the Add method to add an add-in to the list of available add-ins. The Add method adds an add-in to the list but doesn’t install the add-in. Set the Installed property of the add-in to True to install the add-in. To install an add-in that doesn’t appear in the list of available add-ins, you must first use the Add method and then set the Installed property. This can be done in a single step, as shown in the following example (note that you use the name of the add-in, not its title, with the Add method).

AddIns.Add("generic.xll").Installed = True
		

Use AddIns(index) where index is the add-in title or index number to return a single AddIn object. The following example installs the Analysis Toolpak add-in.

AddIns("analysis toolpak").Installed = True
		

Don’t confuse the add-in title, which appears in the Add-Ins dialog box, with the add-in name, which is the file name of the add-in. You must spell the add-in title exactly as it’s spelled in the Add-Ins dialog box, but the capitalization doesn’t have to match.