queryCommandEnabled Method
Returns a Boolean that indicates if the specified command can be executed. Whether or not a command can be executed is based on the current state of the document. For more information on the state of the current document, see the document's readyState property.
expression.queryCommandEnabled(cmdID)
expression Required. An expression that returns one of the objects in the Applies To list.
cmdID Required. A String that represents the command identifier. For a list of available commands see the execCommand method.
Example
The following example prompts the user to enter a command identifier. The queryCommandEnabled method is executed using the user input and a message is displayed to the user depending on the result of the method.
Sub QueryCommand()
'Determines if a command can be executed
'based on the document state.
Dim objApp As FrontPage.Application
Dim objDoc As DispFPHTMLDocument
Dim strUser As String
Set objApp = FrontPage.Application
Set objDoc = objApp.ActiveDocument
'Prompt user to enter command name.
strUser = InputBox("Enter a command identifier to be executed.")
'Attept to run the associated command
If objDoc.queryCommandEnabled(cmdID:=strUser) = True Then
'If yes - display message.
MsgBox "The command " & strUser & " can be executed."
Else
'If no - display message.
MsgBox "The command " & strUser & " cannot be executed."
End If
End Sub