CommandBars.ExecuteMso method (Office)

Executes the control identified by the idMso parameter.


expression.ExecuteMso (idMso)

expression An expression that returns a CommandBars object.


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


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.


The following sample executes the Copy button.


See also

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.