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.
Prompts
- The tool's own add-ins should load without an Enable Macros prompt.
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,.xlsand.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.
- 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, andAddIns.AddwithInstalledorLoaded, 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,pullandinstallon 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.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| vba-0.1.2.tar.gz | 45.0 kB | Without provenance | Details for vba-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| vba-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for vba-0.1.2-py3-none-any.whl |
Total release size: 82.5 kB
Release files / vba-0.1.2.tar.gz
| Download URL | vba-0.1.2.tar.gz |
|---|---|
| Size | 45.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0431d27b5c0d5e40e4d4d61a060fa229886aef289c6221fe50b403c4f286470e
|
|
BLAKE2b-256 checksum How to use checksums |
be062ca3eafda5ba589b235ee49b63cbb172d644733abd4c9142f9f6f40cae94
|
| 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.2-py3-none-any.whl
| Download URL | vba-0.1.2-py3-none-any.whl |
|---|---|
| Size | 37.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7f86b03cf478ff2e70d8fe23e7d4dc158e086f9be43e5192c56045964e578759
|
|
BLAKE2b-256 checksum How to use checksums |
2034f8e46391218a2e9a0b9e04ed188ae6065c6b51ceb5bf52c48a557d8ce9a9
|
| 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.2
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.