Class AddIns2 (Excel VBA)

A collection of AddIn objects that represent all the add-ins that are currently available or open in Microsoft Excel, regardless of whether they are installed. To use a AddIns2 class variable it first needs to be instantiated, for example


Dim ai2 as AddIns2
Set ai2 = Application.AddIns2

Add

Adds a new add-in to the list of add-ins.

Add (Filename, CopyFile)


Dim strFilename As String: strFilename = 
Dim adi As AddIn
Set adi = Application.AddIns2.Add(Filename:=strFilename)

Arguments

The following argument is required

Filename (String) - The name of the file that contains the add-in to add to the list in the Add-Ins dialog box.

Optional arguments

The following argument is optional

CopyFile (Boolean) - If the add-in file is on a removable medium, specifies whether to copy the add-in to the local hard disk. Specify True to copy the add-in to your hard disk. Specify False to keep the add-in on the removable medium. If this argument is omitted, Microsoft Excel displays a dialog box and asks the user to choose whether to copy the add-in file. This parameter is ignored if the add-in file is already on the hard disk.

Count

Returns a Long value that represents the number of objects in the collection.


Dim lngCount As Long
lngCount = Application.AddIns2.Count

Item

Returns a single object from a collection.

Item (Index)

Index: The name or index number of the object.


Dim adiItem As AddIn
Set adiItem = Application.AddIns2(Index:="Analysis ToolPak")