Run VBA source
xlide_run_vbaRun VBA code in Office documents to test macros or extract data, returning output and errors as data without dialogs.
Instructions
Injects VBA source into a document and calls one procedure from it, under a deadline. Windows only. Use it to check what a piece of code actually does before writing it into a file, or to read something out of a document that no existing macro exposes. With no file_path it runs in a new empty document. Errors come back as data with the failing line and call stack, never as a dialog. Call PyVbaLog "text" from the code to return output; Debug.Print and MsgBox do not work under automation.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| args | No | Arguments, in order. Scalars only. | |
| host | No | 'excel', 'word', 'powerpoint' or 'access'. Ignored with file_path. | excel |
| source | Yes | VBA source to inject. | |
| timeout | No | Seconds before the run is terminated. | |
| file_path | No | Run against this document instead of a new empty one. | |
| procedure | No | Procedure to call. Empty calls the first one in the source. | |
| read_only | No | Open the document read-only. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||