Skip to main content

vba

Read, change, debug and install VBA for Word, Excel and PowerPoint, from the command line or an MCP client.

  • Reads and writes the macros inside Office files with pyOpenVBA. No Office needed.
  • On a Mac, loads changed code into the running app without a restart and runs it on one file.
  • Installs finished code in your macro file: backed up, checked, and only while the app is closed.

What works where

Mac Windows Linux
list, pull, install Yes Yes, but not yet tried on a real PC Same, with --file
load, run, exec, unload, status Yes No No
Default macro files Found Looked for in %APPDATA%\Microsoft None
mcp All tools vba_help, vba_list, vba_pull vba_help, vba_list, vba_pull

Live control uses AppleScript, so it is Mac only; see To do for Windows. Until then, on Windows: test a change in the VBA editor, then install it with the app closed.

Run

uvx vba --help                        # needs only uv
uvx --from /path/to/vba vba --help    # from a checkout

vba --help is the reference for commands, defaults and limits.

MCP

{
    "command": "uvx",
    "args": ["vba", "mcp"]
}

The server runs VBA in your open Office apps, so a client can do whatever VBA can. It has no install, and an Excel file given as doc is copied first; other files the code opens are not.

How live loading works

Dev add-in Loaded by
Word VBADev.dotm in the Word startup folder AppleScript add addin
Excel VBADev.xlam in the Add-Ins folder A loader add-in in the Excel startup folder
PowerPoint VBADev.ppam in the Add-Ins folder AppleScript register add in

An app reads an add-in only when it loads it, so each update is unload, replace, load. run and exec add a caller to the code that checks the target file, catches errors and returns a function's value.

Where the files go

OFFICE is ~/Library/Group Containers/UBF8T346G9.Office, and CONTENT is OFFICE/User Content.localized. HOME is the data folder in note 7 of vba --help.

File Location Removed
Word dev add-in CONTENT/Startup.localized/Word/VBADev.dotm By unload, or at the end of exec
Excel dev add-in CONTENT/Add-Ins.localized/VBADev.xlam Same
PowerPoint dev add-in CONTENT/Add-Ins.localized/VBADev.ppam Same
Excel loader CONTENT/Startup.localized/Excel/VBALoader.xlam By vba excel unload --loader, with Excel closed
Loaded code HOME/dev/APP.bas By unload, or at the end of exec
Macro result OFFICE/vba_result.txt After each run
Excel copies of --doc HOME/copies/NAME-TIME.xlsx Never
install backups HOME/backups/NAME-TIME.EXT Never
Files being read or built System temp folder When the step ends

--new opens an unsaved file. If exec stops on a dialog or a timeout, the add-in stays until unload. After the app restarts, Word and Excel load an add-in that was not unloaded; PowerPoint does not.

Prompts

  • The tool's own add-ins loaded without an Enable Macros prompt in Word, Excel and PowerPoint on one Mac, with macros set to "disable with warning" (vba 0.1.2, December 2026). A Mac's very first use is not tested. Excel would prompt for an ordinary open, so the loader uses AddIns.
  • A document that can hold macros (such as .docm, .xlsm, .xlsb, .pptm, or the older .doc, .xls and .ppt) may prompt when opened. The tool does not open it: open it yourself first. For Excel also use --in-place, or save it as .xlsx.
  • macOS asks to allow Accessibility (to see dialogs) and Automation (to control the app) for the terminal or MCP client. Office may ask for access to other files that a macro opens.

Limits

  • Code that does not compile, or a MsgBox, opens a dialog that you must answer. Until then the tool sends the app nothing, because Excel quits on a command sent during a dialog.
  • An endless loop blocks the app.
  • Excel: load needs an open workbook; a hidden one such as PERSONAL.XLSB does not count. run and exec open theirs first.
  • A macro acts on the active file. The target is checked just before it runs.
  • Undo: Word and PowerPoint only. Files a macro writes or deletes cannot be undone.
  • No breakpoints or stepping; use the VBA editor for those.

To do

  • Windows: live commands, possibly through COM. Ideas, none tried:
    • Application.Run, and AddIns.Add with Installed or Loaded, are available to COM directly, so Excel may not need the loader.
    • Calling COM from PowerShell would keep pyOpenVBA the only dependency; pywin32 would add one.
    • Check what macro prompts appear under COM without changing security settings, and find another way to see dialogs than the Mac's Accessibility.
  • Windows and Linux: try list, pull and install on real machines.

Test

PYTHONDONTWRITEBYTECODE=1 uv run --no-project --with-editable . --with pytest pytest -p no:cacheprovider

Publish

bash publish.sh --help

License

AGPL-3.0-or-later

Metadata

Release files for vba 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vba 0.1.3
File Size Uploaded Provenance Actions
vba-0.1.3.tar.gz 45.5 kB Without provenance Details for vba-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for vba 0.1.3
File Interpreter ABI Platform Actions
vba-0.1.3-py3-none-any.whl Python 3 none any Details for vba-0.1.3-py3-none-any.whl

Total release size: 83.3 kB

Release files / vba-0.1.3.tar.gz

Download URL vba-0.1.3.tar.gz
Size 45.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0dea93f4ca973f42a8145d4ece49aad83ce54f841fb08032d54bdbb83fdd4317
BLAKE2b-256 checksum
How to use checksums
471765b4c72fdd9e9cd5fb8dcd49d726c491ec2fbc17027f33c5edc73f43d8ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / vba-0.1.3-py3-none-any.whl

Download URL vba-0.1.3-py3-none-any.whl
Size 37.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5b3846d8ef0dd6657f0507890106f2e8135efbd2939d32cb4470e1592943aa8d
BLAKE2b-256 checksum
How to use checksums
208d1b259858d546da4d802bf7bec495478cce9e70a56c95218856172932ec21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for vba 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page