execCommand Method

       

Executes a specified command and returns a Boolean that indicates the outcome of the search.

expression.execCommand(cmdID, showUI, value)

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 the specified argument.

showUI  Optional. A Boolean that specifies if the user interface associated with the command will be displayed. The default value is False.

value  Optional. A Variant that specifies any additional arguments associated with the cmdID parameter.

Example

The following example deletes the current selection and returns a Boolean that stores the outcome of the command.

Sub ExecCmd()
'Executes a command based on the specified
'parameters

     Dim objApp As FrontPage.Application
     Dim objDoc As DispFPHTMLDocument
     Dim blnSuccess as Boolean

     Set objApp = FrontPage.Application
     Set objDoc = objApp.ActiveDocument
     'Delete the current selection.
     blnSuccess = objDoc.execCommand (cmdID:="Delete")

End Sub

The following example changes the font of the current selection to Arial and returns True if successful. The showUI argument is set to False meaning that the associated user interface will not be displayed.

     blnSuccess = objDoc.execCommand (cmdID:="FontName",
                         _ ShowUI:=False, Value:=arial)