Run a macro
xlide_run_macroExecute an existing macro in an Office file under a deadline. Returns the procedure's result, logs, and VBA error details, and terminates the app on timeout.
Instructions
Runs a procedure that already exists in an Office file, in an application this server starts and owns, under a deadline. Windows only, with the application installed. The document opens read-only unless read_only=false, and closes without saving unless save=true. Returns the procedure's return value, anything it logged, and, on a VBA error, the error number and message. The failing line and call stack come from instrumentation applied to injected source, so a procedure already in the document does not carry them; run the same code through xlide_run_vba when you need them. A run that exceeds its timeout reports 'timeout' and the application is terminated. Ask the user before running a macro that changes data.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| args | No | Arguments, in order. Scalars only. | |
| save | No | Save the document after the run. Needs read_only=false. | |
| timeout | No | Seconds before the run is terminated. | |
| file_path | Yes | Absolute path to the Office file. | |
| procedure | Yes | Procedure to call, as 'Proc' or 'Module.Proc'. | |
| read_only | No | Open the document read-only. False lets the macro change it. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||