CountMacros()

Syntax

CountMacros([Context] [All] [Global])

Remarks

Returns the number of macros available in the specified context.

Argument

Explanation

Context

Specifies the template in which to count macros:

0 (zero) or omitted Normal template

1 Active template

Note that if you specify 1 and Normal is the active template, CountMacros() returns 0 (zero).

All

If 1, all available macros, add-in commands, and built-in commands are included in the count.

Global

If 1, only macros stored in loaded global templates and add-in commands are counted.


Example

This example stores the number of built-in commands in builtins and then inserts in the active document a list of the names of the built-in commands:


loaded = CountMacros(0, 0, 1)
active = CountMacros(1)
normal = CountMacros(0)
templates = active + normal
nonbuiltins = loaded + templates
builtins = CountMacros(0, 1) - nonbuiltins
For count = 1 to builtins
    pos = count + nonbuiltins
    Insert Str$(count) + Chr$(9) + MacroName$(pos, 0, 1)
    InsertPara
Next count

See Also

ListCommands, MacroName$()