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.1.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} ...
         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 implemented for word-vba:                         {excel-vba planned in v0.2.0}

    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

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

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

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.

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.1.1.tar.gz (20.7 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.1.1-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: vba_edit-0.1.1.tar.gz
  • Upload date:
  • Size: 20.7 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.1.1.tar.gz
Algorithm Hash digest
SHA256 f538734307b963b270e3600844f0ad947079b4f559390b68965d84503024e4e3
MD5 db856fb1e87f5e62e78f5e5d8191b828
BLAKE2b-256 807836d2f4245824387abacfa44e0fbd8a1dce63e6a0e2c4b51824846f0b80f8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vba_edit-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 19.1 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.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3ca39f7cbd98f87a84d0e6dfd1ae12469b32c8ab2b1b77c52cb684918c66b866
MD5 532c11121d2d82dc089c46b323040699
BLAKE2b-256 82f072a68b57156df779cf3fdabcec96dec9c22b487a59b138ca2fe89c86b575

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