This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Download Microsoft Edge
More info about Internet Explorer and Microsoft Edge
Executes the control identified by the
idMso
parameter.
Syntax
expression
.
ExecuteMso
(
idMso
)
expression
An expression that returns a
CommandBars
object.
Parameters
Required/Optional
Data type
Description
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")
See also
CommandBars object members
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.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see: https://aka.ms/ContentUserFeedback.
Submit and view feedback for