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.2.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.2-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: vba_edit-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 784a4f066bf68485a4641b2bfa9d3d372e83ae730ce67dc7066f2ebbf22a53a6
MD5 1f949ad5687fa1f69745c0c476b5d600
BLAKE2b-256 2c1a925b39d2316c525af5797e7a9744d61f3537786bff6678c84fde7104a6d5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vba_edit-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e0547a9d6ad21554851159488dde34b92a3ecf4fcb3cb8a492e8453eee063f5c
MD5 9c21945d761440b01381b1123b295236
BLAKE2b-256 096230579969da54232deafc878cf5453cc36bc3071838f3a86998ae28f76fb4

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