Syntax
CommandValid(CommandName$)
Remarks
Indicates whether CommandName$ is a valid WordBasic statement and, if so, whether it is available in the current context.
The CommandValid() function returns the following values.
Value | Explanation | |
-1 | If CommandName$ is valid and is available in the current context | |
0 (zero) | If CommandName$ is valid but is not available in the current context | |
1 | If CommandName$ is not valid |
Example
This example tests whether the Undo command (Edit menu) is available. If it is, the previous editing or formatting command is undone.
If CommandValid("EditUndo") = -1 Then EditUndo End If
See Also
IsMacro()