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 PyPI - Downloads License

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.3.0 (word-vba|excel-vba|access-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} ...
         usage: excel-vba [-h] {edit,import,export} ...
         usage: access-vba [-h] {edit,import,export} ...      
         usage: powerpoint-vba [-h] {edit,import,export} ...  {planned in v0.4.0}   

Commands:
    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

Examples :                          
    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
    word-vba edit --save-headers
    

    Options:

    word-vba  import -f "C:/path/to/document.docx" --vba-directory "path/to/vba/files"
    word-vba  export --file "C:/path/to/document.docx" --encoding cp850 --save-metadata
    word-vba  edit --vba-directory "path/to/vba/files" --logfile "path/to/logfile" --verbose

positional arguments:
  {edit,import,export}
    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 VBA project object model' is enabled

options:
  -h, --help            Show this help message and exit