queryCommandIndeterm 方法

       

返回 Boolean 类型值,此值决定指定的命令是否将返回一不确定状态。不确定状态意味着此命令不能返回具有指定参数的二进制结果。例如,如果当前选择包含粗体和非粗体文本,则 Bold 命令将返回不确定状态。如果为 True,则命令将返回不确定结果。如果为 False,则命令将返回二进制结果。

expression.queryCommandIndeterm(cmdID)

expression  必选。返回 DispFPHTMLDocument 对象的表达式。

cmdID  必选。String 类型。代表指定命令的标识符。

示例

以下示例提示用户输入命令标识符以决定指定的命令是否将返回不确定状态。根据此方法的执行结果向用户显示一条消息。

Sub QueryCommand()
'Determines if a command will return an
'indeterminate 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.")
    'Run the associated command

    If objDoc.queryCommandIndeterm(cmdID:=strUser) = True Then
        'If yes - display message.
        MsgBox "The command " & strUser & _
               " will return an indeterminate state."
    Else
        'If no - display message.
        MsgBox "The command " & strUser & _
               " will not return an indeterminate state."
    End If

End Sub