queryCommandSupported Method

Returns a Boolean that indicates if the specified command is supported by the current selection.

expression.queryCommandSupported(cmdID)

*expression   * Required. An expression that returns one of the objects in the Applies To list.

cmdID    Required. A String that represents the specified command identifier. For a list of available commands see the execCommand method.

Example

The following example prompts the user to enter a command identifier. A message is displayed to the user depending on the result of the command.

Sub QueryCommand()
'Determines whether a command is supported
'by the current selection

    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.")
    'Run the associated command
    If objDoc.queryCommandSupported(cmdID:=strUser) = True Then
        'If yes - display message.
        MsgBox "The command " & strUser & _
               " is supported by the current selection."
    Else
        'If no - display message.
        MsgBox "The command " & strUser & _
               " is not supported by the current selection."
    End If

End Sub

Applies to | FPHTMLDocument Object | IHTMLDocument2 Object | IHTMLTxtRange Object