Class AddIn (Word VBA)
The class AddIn represents a single add-in, either installed or not installed. The AddIn object is a member of the AddIns collection. The AddIns collection contains all the add-ins available to Microsoft Word, regardless of whether they are currently loaded. The AddIns collection includes global templates or Word add-in libraries (WLLs) displayed in the Templates and Add-ins dialog box. To use a AddIn class variable it first needs to be instantiated, for example
Dim adi as AddIn
Set adi = AddIns(Index:=1)
For Each
Here is an example of processing the AddIn items in a collection.
Dim adi As AddIn
Dim iCount
For Each adi In AddIns
If adi.Compiled = True And adi.Installed = True Then
iCount = iCount + 1
End If
Next adi
MsgBox iCount & " WLL's are loaded"
Autoload
True if the specified add-in is automatically loaded when Word is started. Add-ins located in the Startup folder in the Word program folder are automatically loaded.
Dim booAutoload As Boolean
booAutoload = AddIns(1).Autoload
Compiled
True if the specified add-in is a Word add-in library (WLL). False if the add-in is a template.
Dim booCompiled As Boolean
booCompiled = AddIns(1).Compiled
Delete
Deletes the specified add-in.
AddIns(1).Delete
Index
Returns a Long that represents the position of an item in a collection.
Dim As Variant
AddIns(1).Index
Installed
True if the specified add-in is installed (loaded). Add-ins that are loaded are selected in the Templates and Add-ins dialog box.
Uninstalled add-ins are included in the AddIns collection. To remove a template or WLL from the AddIns collection, apply the Delete method to the AddIn object (the add-in name is removed from the Templates and Add-ins dialog box). To unload all templates and WLLs, apply the Unload method to the AddIns collection.
Addins("Gallery.dot").Installed = False
Name
Returns the name of an add-in.
Dim strName As String
strName = AddIns(1).Name
Path
Returns the location of an installed add-in.
The path doesn't include a trailing character— for example, "C:\MSOffice" or "https://MyServer". Use the PathSeparator property to add the character that separates folders and drive letters. Use the Name property to return the file name without the path and use the FullName property to return the file name and the path together.
If AddIns.Count >= 1 Then MsgBox AddIns(1).Path