vba-edit

Enable seamless MS Office VBA code editing in preferred editor or IDE (facilitating the use of coding assistants and version control workflows)


CI PyPI - Version PyPI - Python Version Platform PyPI - Downloads Ruff License

Links

Quickstart

Python Package Installation (Recommended)

pip install -U vba-edit

or

uv pip install -U vba-edit

Windows Binaries (No Python Required)

NEW v0.4.1+ Standalone executables available – no Python installation needed!

Download: Latest Release (scroll all the way down to Assets section)

Available binaries:

  • excel-vba.exe – For Excel workbooks
  • word-vba.exe – For Word documents
  • access-vba.exe – For Access databases
  • powerpoint-vba.exe – For PowerPoint presentations

Security: See Security Verification Guide for SHA256 checksums and attestation validation.

⚠️ Windows SmartScreen & VirusTotal Warnings: Binaries are currently unsigned. You may see warning messages – this is expected. See Issue #24 and Security Info for details.

Overview command-line tools

vba-edit v0.4.1 (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 this document's  
                          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

Complete Option Matrix

All options across all commands in a single table

Option edit export import Notes
Common Options * * * * * * * * * * * * * * * * * * * *
--verbose / -v YES YES YES Enable verbose logging output
--logfile / -l YES YES YES Enable logging to file (default: vba_edit.log)
--no-color / --no-colour YES YES YES Disable colored output
--help / -h YES YES YES Show help message and exit
File & Directory Options
--file / -f YES YES YES Path to Office document (default: active document)
--vba-directory YES YES YES Directory for VBA files (default: same as document)
--open-folder YES YES NO Open export directory in file explorer after operation
Configuration
--conf / --config YES YES YES Path to configuration file (TOML format)
Encoding Options (mutually exclusive)
--encoding / -e YES YES YES Encoding for VBA files (default: cp1252)
--detect-encoding / -d YES YES YES Auto-detect file encoding for VBA files
Header Options (mutually exclusive)
--save-headers YES YES NO Save VBA component headers to separate .header files
--in-file-headers YES YES NO Include VBA headers directly in code files
Folder Organization
--rubberduck-folders YES YES YES Organize folders per RubberduckVBA @Folder annotations (bi-directional)
Metadata Options
--save-metadata / -m YES YES NO Save metadata to file
Export-Specific Options
--force-overwrite NO YES NO Force overwrite of existing files without prompting
--keep-open NO YES NO Keep document open after export (default: close)
Excel-Specific Options
--xlwings / -x YES YES YES Use wrapper for xlwings vba commands (Excel only)