Enable seamless MS Office VBA code editing in preferred editor or IDE (facilitating the use of coding assistants and version control workflows)
Links
Quickstart
Installation
To install vba-edit
, you can use pip
:
pip install vba-edit
or uv pip
:
uv pip install vba-edit
Overview command-line tools
vba-edit v0.4.0 (word-vba|excel-vba|access-vba|powerpoint-vba)
A command-line tool suite for managing VBA content in MS Office documents.
WORD|EXCEL|...-VBA allows you to edit, import, and export VBA content
from Office documents. If no file is specified, the tool will attempt
to use the currently active document.
usage: word-vba [-h] {edit,import,export, check} ...
usage: excel-vba [-h] {edit,import,export, check} ...
usage: access-vba [-h] {edit,import,export, check} ...
usage: powerpoint-vba [-h] {edit,import,export,check} ...
Example:
word-vba edit <--- uses active Word document and current directory for exported
VBA files (*.bas/*.cls/*.frm) & syncs changes back to the
active Word document
Examples with options:
word-vba edit --in-file-headers --rubberduck-folders
word-vba import -f "C:/path/to/document.docx" --vba-directory "path/to/vba/files"
word-vba export --config "C:/path/to/myproject.toml" --encoding cp850 --save-metadata
word-vba edit --vba-directory "path/to/vba/files" --logfile "path/to/logfile" --verbose
Command overview | Description |
---|---|
edit |
Edit VBA content in Office document |
import |
Import VBA content into Office document |
export |
Export VBA content from Office document |
check |
Check if ‘Trust Access to the MS Word VBA project object model’ is enabled |
Option Overview | Description |
---|---|
--help , -h |
Show help message and exit |
--file , -f |
Path to Office document |
--conf , --config , -c |
Supply config file (TOML format) |
--vba-directory |
Directory for VBA files |
--rubberduck-folders |
Use RubberduckVBA folder annotations |
--save-headers |
Save module headers separately |
--in-file-headers |
Include VBA headers directly in code files |
--encoding , -e |
Specify character encoding |
--detect-encoding , -d |
Auto-detect encoding |
--verbose , -v |
Enable detailed logging |
--logfile , -l |
Enable file logging |
--open-folder |
Open export directory in file explorer after export |
--save-metadata , -m |
Save metadata file with encoding information |
--force-overwrite |
Skip all confirmation prompts (for automation) |
--version , -V |
Show program’s version number and exit |
