Skip to main content

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

Project description

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

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.2.0 (word-vba|excel-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} ...      {planned in v0.3.0}
         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

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


    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

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

Usage

Working with MS Word VBA code

WORD-VBA EDIT COMMAND
word-vba edit

Updates the VBA modules of the active (or specified) MS Word document from their local exports every time you hit save. If you run this for the first time, the modules will be exported from MS Word into your current working directory.

usage: word-vba edit [-h] [--encoding ENCODING | --detect-encoding]
                     [--file FILE] [--vba-directory VBA_DIRECTORY]
                     [--verbose]

options:
  -h, --help            show this help message and exit
  --encoding ENCODING, -e ENCODING
                        Encoding to be used when reading VBA files from Word document
                        (default: cp1252)
  --detect-encoding, -d
                        Auto-detect input encoding for VBA files exported from Word
                        document
  --file FILE, -f FILE  Path to Word document (optional, defaults to active document)
  --vba-directory VBA_DIRECTORY
                        Directory to export VBA files to (optional, defaults to
                        current directory)
  --verbose, -v         Enable verbose logging output
  --logfile [LOGFILE], -l [LOGFILE]
                        Enable logging to file. Optional path can be specified
                        (default: vba_edit.log)
WORD-VBA EXPORT COMMAND
word-vba export

Overwrites the local version of the modules with those from the active (or specified) Word document.

usage: word-vba export [-h] [--save-metadata] [--encoding ENCODING | --detect-encoding]
                       [--file FILE] [--vba-directory VBA_DIRECTORY] [--verbose]

options:
  -h, --help            show this help message and exit
  --save-metadata, -m   Save metadata file with character encoding information
                        (default: False)
  --encoding ENCODING, -e ENCODING
                        Encoding to be used when reading VBA files from Word
                        document (default: cp1252)
  --detect-encoding, -d
                        Auto-detect input encoding for VBA files exported from
                        Word document
  --file FILE, -f FILE  Path to Word document (optional, defaults to active document)
  --vba-directory VBA_DIRECTORY
                        Directory to export VBA files to (optional, defaults to
                        current directory)
  --verbose, -v         Enable verbose logging output
  --logfile [LOGFILE], -l [LOGFILE]
                        Enable logging to file. Optional path can be specified
                        (default: vba_edit.log)
WORD-VBA IMPORT COMMAND
word-vba import

Overwrites the VBA modules in the active (or specified) Word document with their local versions.

usage: word-vba import [-h] [--encoding ENCODING] [--file FILE]
                       [--vba-directory VBA_DIRECTORY] [--verbose]

options:
  -h, --help            show this help message and exit
  --encoding ENCODING, -e ENCODING
                        Encoding to be used when writing VBA files back into Word
                        document (default: cp1252)
  --file FILE, -f FILE  Path to Word document (optional, defaults to active document)
  --vba-directory VBA_DIRECTORY
                        Directory to export VBA files to (optional, defaults to
                        current directory)
  --verbose, -v         Enable verbose logging output
  --logfile [LOGFILE], -l [LOGFILE]
                        Enable logging to file. Optional path can be specified
                        (default: vba_edit.log)

Working with MS Excel VBA code

excel-vba edit

Updates the VBA modules of the active (or specified) MS Excel document from their local exports every time you hit save. If you run this for the first time, the modules will be exported from MS Excel into your current working directory.

excel-vba export

Overwrites the local version of the modules with those from the active (or specified) Excel document.

excel-vba import

Overwrites the VBA modules in the active (or specified) Excel document with their local versions.

Video Tutorial

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vba_edit-0.2.0.tar.gz (23.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vba_edit-0.2.0-py3-none-any.whl (22.5 kB view details)

Uploaded Python 3

File details

Details for the file vba_edit-0.2.0.tar.gz.

File metadata

  • Download URL: vba_edit-0.2.0.tar.gz
  • Upload date:
  • Size: 23.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for vba_edit-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6ba49439481a61fd3a3a152956c1d1862ec7673eeee8682fdb11b4b8bc72f00b
MD5 b9c675d5fe7dd60653ab37d2b09650c7
BLAKE2b-256 a467cb167127ff4cd2a09c315e4f0cafe17adda946172300c37ac873071e4101

See more details on using hashes here.

File details

Details for the file vba_edit-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: vba_edit-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 22.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for vba_edit-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 33062f87b352810db34663b3467946279af3f1c5114f318dfd176b6f3d7a4f15
MD5 620aa3bd9ea6b9a02d98c6ab486b97e4
BLAKE2b-256 aa9ec5c47d57ac5163205c757ed93c8948d1747071a60b0596cef3977678e76c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page