execCommand method

[This documentation is preliminary and is subject to change.]

Executes a command on the current document, current selection, or the given range.

Syntax

VARIANT_BOOL retVal = object.execCommand(cmdID, showUI, value);

Standards information

There are no standards that apply here.

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.

Remarks

Do not invoke the 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 IOleCommandTarget::Exec method to enable scriptable execution of some command constants. IOleCommandTarget::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 IOleCommandTarget::Exec method to enable scriptable execution of some command constants. IOleCommandTarget::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 IOleCommandTarget::Exec method to enable scriptable execution of some command constants. IOleCommandTarget::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

queryCommandEnabled

queryCommandIndeterm

queryCommandState

queryCommandSupported

queryCommandValue

Conceptual

Command Identifiers

 

 

Build date: 6/12/2012