Skip to main content

CommandBars.ExecuteMso method

Executes the control identified by the idMso parameter.

Syntax

expression.ExecuteMso (idMso)

expression An expression that returns a CommandBars object.

Parameters

Name Required/Optional Data type Description
idMso Required String Identifier for the control.

Remarks

This method is useful in cases where there is no object model for a particular command. Works on controls that are built-in buttons, toggleButtons, and splitButtons. On failure it returns E_InvalidArg for an invalid idMso, and E_Fail for controls that are not enabled or not visible.

Example

The following sample executes the Copy button.

Application.CommandBars.ExecuteMso("Copy")

Leave a comment

Your email address will not be published. Required fields are marked *

Format your code: <pre><code class="language-vba">place your code here</code></pre>