Microsoft Word Addin Object Visual Basic for Applications

Microsoft Word Addin Object Visual Basic for Applications

Add-in

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.

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 is shown in the Templates and Add-Ins dialog box. The following example loads the “Test.dot” template as a global template.

Installed: setting property to True will install the Addin and False will uninstall the same.

Code example

Public Sub LoadAddinByName()
    AddIns("Test.dot").Installed = True
End Sub

Path

Public Sub ShowAddinPath()
    Dim oAddin As AddIn
    'Iterate each addin
    For Each oAddin In Application.AddIns
        'Print addin path
        Debug.Print oAddin.Path
    Next oAddin
End Sub

Add Method

Public Sub LoadAddinFromPath()
    AddIns.Add FileName:="C:\Templates\user\Test.dot", Install:=True
End Sub

Name Property

Public Sub ShowAddinName()
    Dim oAddin As AddIn
    'Iterate each addin
    For Each oAddin In Application.AddIns
        'Print addin path
        Debug.Print oAddin.Name
    Next oAddin
End Sub

Please leave your comments or queries under comment section also please do subscribe to out blogs to keep your self upto date.

Leave a Reply

Your email address will not be published. Required fields are marked *