> ## Documentation Index
> Fetch the complete documentation index at: https://rpa.bazhuayu.com/helpcenter/llms.txt
> Use this file to discover all available pages before exploring further.

# 运行Excel宏

## 指令说明

**描述：** 在Excel文件中执行指定宏命令。

## 参数说明

<Tabs>
  <Tab title="常规">
    <img src="https://mintcdn.com/bazhuayu-rpa-docs/XU4apql8B34CRdwD/helpcenter/commands/excel/images/runexcelmacrocommand-01.png?fit=max&auto=format&n=XU4apql8B34CRdwD&q=85&s=84fc3ec1efefc887e479a7a2e6115980" alt="运行Excel宏指令参数面板" width="655" height="304" data-path="helpcenter/commands/excel/images/runexcelmacrocommand-01.png" />

    | 参数          | 说明                                         |
    | ----------- | ------------------------------------------ |
    | **Excel对象** | 输入一个通过"启动Excel"或"获取当前激活的Excel对象"产生的Excel对象 |
    | **宏名称**     | 输入在Excel文件中已存在的宏名称                         |
  </Tab>

  <Tab title="高级">
    <img src="https://mintcdn.com/bazhuayu-rpa-docs/XU4apql8B34CRdwD/helpcenter/commands/excel/images/runexcelmacrocommand-02.png?fit=max&auto=format&n=XU4apql8B34CRdwD&q=85&s=e705905b69f4c9860ed16238f930e9fc" alt="运行Excel宏高级参数面板" width="658" height="248" data-path="helpcenter/commands/excel/images/runexcelmacrocommand-02.png" />

    | 参数      | 说明                             |
    | ------- | ------------------------------ |
    | **宏参数** | 输入宏中需要传递的实际参数，可新增多个参数，宏参数为列表类型 |
  </Tab>
</Tabs>

## 使用示例

<img src="https://mintcdn.com/bazhuayu-rpa-docs/XU4apql8B34CRdwD/helpcenter/commands/excel/images/runexcelmacrocommand-03.png?fit=max&auto=format&n=XU4apql8B34CRdwD&q=85&s=bcb067d69c3bd7b8370c308137662846" alt="运行Excel宏使用示例" width="920" height="239" data-path="helpcenter/commands/excel/images/runexcelmacrocommand-03.png" />

**该流程执行逻辑：**

使用【启动Excel】打开已有的启用宏的Excel，并将Excel对象保存到excel对象

使用【运行Excel宏】在excel对象中执行名称为Macro1的宏命令

使用【获取当前激活的Excel对象】获取当前激活的Excel对象，将对象保存到excel1

使用【关闭Excel】指令关闭并保存excel1对象

### 效果展示

<img src="https://mintcdn.com/bazhuayu-rpa-docs/XU4apql8B34CRdwD/helpcenter/commands/excel/images/runexcelmacrocommand-04.png?fit=max&auto=format&n=XU4apql8B34CRdwD&q=85&s=82e1625dc76e6a5c58ca8e33ae3a22f8" alt="运行Excel宏效果展示" width="905" height="132" data-path="helpcenter/commands/excel/images/runexcelmacrocommand-04.png" />

<img src="https://mintcdn.com/bazhuayu-rpa-docs/XU4apql8B34CRdwD/helpcenter/commands/excel/images/runexcelmacrocommand-05.png?fit=max&auto=format&n=XU4apql8B34CRdwD&q=85&s=4a054905db6a08e80088d3ff9b5fc12a" alt="运行Excel宏效果展示" width="1241" height="339" data-path="helpcenter/commands/excel/images/runexcelmacrocommand-05.png" />

<Info>
  使用指令过程中遇到问题？前往 [八爪鱼RPA 开发者社区问答板块](https://rpa.bazhuayu.com/community/questions) 提问，获取官方与社区帮助。
</Info>
