execCommand method
Executes a command on the current document, current selection, or the given range.
Syntax
retVal = object.execCommand(cmdID, showUI, value);
Parameters
cmdID [in]
Type: BSTR
BSTR that specifies the command to execute. This command can be any of the command identifiers that can be executed in script.
showUI [in, optional]
Type: VARIANT_BOOL
VARIANT_BOOL that specifies one of the following values.
VARIANT_FALSE (false)
Default. Do not display a user interface. Must be combined with value, if the command requires a value.
VARIANT_TRUE (true)
Display a user interface if the command supports one.
value [in, optional]
Type: VARIANT
VARIANT that specifies the string, number, or other value to assign. Possible values and possible VARIANT subtypes depend on the command.
Standards information
There are no standards that apply here.
Remarks
Do not invoke the IHTMLDocument2::execCommand method until after the page loads.
The showUI and value parameters might be required depending on the command being executed.
This method is a wrapper function for the Exec method to enable scriptable execution of some command constants. Exec provides better performance and greater versatility than this method. You can obtain an IOleCommandTarget interface by calling QueryInterface on the IHTMLDocument2 interface using IID_IOleCommandTarget.
This method is a wrapper function for the Exec method to enable scriptable execution of some command constants. Exec provides better performance and greater versatility than this method. You can obtain an IOleCommandTarget interface by calling QueryInterface on the IHTMLControlRange interface using IID_IHTMLControlRange for the IID.
This method is a wrapper function for the Exec method to enable scriptable execution of some command constants. Exec provides better performance and greater versatility than this method. You can obtain an IOleCommandTarget interface by calling QueryInterface on the IHTMLTxtRange interface using IID_IHTMLTxtRange for the IID.
See also
Reference
IHTMLDocument2::queryCommandEnabled
IHTMLDocument2::queryCommandIndeterm
IHTMLDocument2::queryCommandState
IHTMLDocument2::queryCommandSupported
IHTMLDocument2::queryCommandValue
Conceptual