queryCommandText 方法


返回 String 类型值,此值代表与指定命令相关联的文本值。


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

cmdID  必选,String 类型。代表命令标识符。



Sub QueryCommand()
'Determines the value of a specified command

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument
    Dim strUser As String
    Dim strValue 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.
    strValue = objDoc.queryCommandText(strUser)
    MsgBox "The text value associated with the specified command is: " & strValue
End Sub