AddAddIn, AddAddIn()

Syntax

AddAddIn AddIn$ [Load]

AddAddIn(AddIn$ [Load])

Remarks

The AddAddIn statement adds a template or Word add-in library (WLL) to the list of global templates and add-ins in the Templates And Add-ins dialog box (Templates command, File menu).

Argument

Explanation

AddIn$

The path and filename of the template or WLL

Load

Specifies whether to load the template or add-in after adding it to the list:

0 (zero) Does not load the template or add-in

1 or omitted Loads the template or add-in


The AddAddIn() function behaves the same as the statement and also returns a value corresponding to the position of the global template or add-in in the list, where 1 is the first template or add-in, 2 is the second, and so on. This value may be used with other add-in statements and functions.

You can use functions defined in a loaded WLL in a macro. Functions that take no arguments may be used just like WordBasic statements; you can return the names of these functions using CountMacros() and MacroName$(). Functions in the WLL that take arguments must be declared using the Declare statement.

For more information on loading global templates and add-ins, see "add-in programs" in Help. For more information on using functions in WLLs, see Chapter 9, "More WordBasic Techniques," in Part 1, "Learning WordBasic."

Example

These examples use AddAddIn() to load a global template and define the variable id as a numeric identifier for the template:


id = AddAddIn("C:\MYDOT\MYLIB.DOT", 1)            'Windows example
id = AddAddIn("HD:TEMPLATES:LIB TEMPLATE", 1)    'Macintosh example

The following example fills an array with the names of functions in loaded WLLs that can be called from a macro just like Word commands:


nonaddins = CountMacros(0) + CountMacros(1)
loaded = CountMacros(0, 0, 1)
size = loaded - 1
If size >= 0 Then
    Dim loaded$(size)
    For count = 0 To size
        pos = (count + 1) + nonaddins
        loaded$(count) = MacroName$(pos, 0, 1)
    Next count
End If

See Also

AddInState, ClearAddIns, CountAddIns(), CountMacros(), DeleteAddIn, GetAddInID(), GetAddInName$(), MacroName$()