The Installed property is True if the add-in is currently installed — that is, if it is checked in the Add-Ins dialog box. Setting the Installed property to True opens the add-in. Setting it to False unloads it. Here's an example of how to install (that is, open) the Analysis ToolPak add-in with VBA:
AddIns("Analysis ToolPak").Installed = True End Sub
After this procedure is executed, the Add-Ins dialog box displays a check mark next to Analysis ToolPak. If the add-in is already installed, setting its Installed property to True has no effect. To remove this add-in (uninstall it), simply set the Installed property to False.
If an add-in was opened with the File ^ Open command, it is not considered to be officially installed. Consequently, its Installed property is False.
The following procedure displays the number of add-ins in the AddIns collection and the number of those that are installed. You'll find that the count does not include add-ins that were opened with the File ^ Open command.
Sub CountInstalledAddIns() Dim Count As Integer Dim Item As AddIn
Dim Msg As String Count = 0
For Each Item In Addlns
If Item.Installed Then Count = Count + 1 Next Item
Msg = "Add-ins: " & AddIns.Count & vbCrLf Msg = Msg & "Installed: " & Count MsgBox Msg End Sub
The next procedure loops through all add-ins in the AddIns collection and unin-stalls any add-in that's installed. This procedure does not affect add-ins that were opened with the File ^ Open command.
Dim Count As Integer Dim Item As AddIn Count = 0
For Each Item In AddIns If Item.Installed Then
Item.Installed = False Count = Count + 1 End If Next Item
MsgBox Count & " Add-Ins Uninstalled." End Sub
You can determine whether a particular workbook is an add-in by accessing its IsAddIn property.This is not a read-only property, so you can also convert a workbook to an add-in by setting the IsAddIn property to True.
And, conversely, you can convert an add-in to a workbook by setting the IsAddIn property to False.After doing so,the add-in's worksheets will be visible in Excel — even if the add-in's VBA project is protected.
Was this article helpful?