AddIn Object

Microsoft Word Visual Basic

AddInsAddIn

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 Word, regardless of whether or not they're currently loaded. The AddIns collection includes global templates or Word add-in libraries (WLLs) displayed in the Templates and Add-ins dialog box (Tools menu).

Using the AddIn Object

Use AddIns(index), where index is the add-in name or index number, to return a single AddIn object. You must exactly match the spelling (but not necessarily the capitalization) of the name, as it's shown in the Templates and Add-Ins dialog box. The following example loads the Letter.dot template as a global template.

AddIns("Letter.dot").Installed = True
		

The index number represents the position of the add-in in the list of add-ins in the Templates and Add-ins dialog box. The following instruction displays the path of the first available add-in.

If Addins.Count >= 1 Then MsgBox Addins(1).Path
		

The following example creates a list of add-ins at the beginning of the active document. The list contains the name, path, and installed state of each available add-in.

With ActiveDocument.Range(Start:=0, End:=0)
    .InsertAfter "Name" & vbTab & "Path" & vbTab & "Installed"
    .InsertParagraphAfter
    For Each oAddIn In AddIns
        .InsertAfter oAddIn.Name & vbTab & oAddIn.Path & vbTab _
            & oAddIn.Installed
        .InsertParagraphAfter
    Next oAddIn
    .ConvertToTable
End With
		

Use the Add method to add an add-in to the list of available add-ins and (optionally) install it using the Install argument.

AddIns.Add FileName:="C:\Templates\Other\Letter.dot", Install:=True
		

To install an add-in shown in the list of available add-ins, use the Installed property.

AddIns("Letter.dot").Installed = True
		

Note  Use the Compiled property to determine whether an AddIn object is a template or a WLL.