Skip to main content

Run macro

Run a VBA macro, with up to 10 arguments, in a macro-enabled workbook (a file, or a workbook open in an Excel session, unsaved changes included) and optionally save.

Command in the Excel desktop toolkit · id ooa.excel_desktop/run_macro · 8 inputs (1 required), 1 output

Inputs​

InputTypeRequiredDefaultWhat it is
PathFileNoWorkbook (.xlsm/.xlsb/.xls); not needed when a session is given.
MacroStringYesMacro name.
ArgumentsListNoArguments passed to the macro (text).
SaveBooleanNotrueSave the workbook afterwards.
Timeout (seconds)NumberNo600Maximum run time.
PasswordCredentialNoPassword needed to open the workbook; passed to Excel through the environment, not the command line.
VisibleBooleanNofalseShow the Excel window while the agent works, e.g. to watch a macro; hidden by default.
SessionStringNoAn Excel session open in this run: the step works on that workbook as it is now, changes not yet saved included; the path is not needed then (G3).

Outputs​

OutputTypeWhat it is
resultStringValue returned by the macro (for Functions), as text.