Skip to content

WilliamSmithEdward/pyOpenVBA

Developer Productivity

A pure‑Python library to read and write VBA macros in Office files without needing Office installed

Python Latest v3.1.0 · 4d ago Security brief →

Features

  • Read VBA modules from Excel, PowerPoint, Word, and Access files
  • Write changes back so the file opens cleanly (add, modify, rename, delete modules)
  • Create new macro‑enabled Office documents programmatically
  • Supports .xlsm, .xlsb, .xlam, .docm, .pptm and read‑only .accdb

Recent releases

View all 9 releases →
No immediate action
v3.1.0 Bug fix

Fix class module compilation

v3.0.0 Breaking risk
Breaking changes
  • Renamed module `pyopenvba.access` to `pyopenvba.access_read`
  • Renamed class `AccessFile` to `AccessReader`
Notable features
  • Added EXPERIMENTAL read‑only `AccessReader` supporting Access .accdb/.mdb parsing with VBA module extraction
Full changelog

Added

  • AccessReader (EXPERIMENTAL) -- pure-Python read-only support for
    Microsoft Access .accdb / .mdb (ACE / Jet 4) databases:
    • AccessReader(path) parses the 4 KiB page-layout file header and
      validates the ACE / Jet signature.
    • iter_vba_modules() yields every embedded VBA module (VBAModule
      dataclass with name, start_offset, attributes_text, source).
      Modules are discovered by scanning for MS-OVBA stream signatures and
      walking the LVAL page chains they live on -- no Access COM, no
      MSysObjects parser required.
    • vba_module_names() deduplicates shadow / undo copies and returns
      the live module name list.
    • read_vba_module(name) returns the user-visible source string with
      \r\n line endings preserved; matches Access COM
      CodeModule.Lines() output byte-for-byte (verified on a 1000-line
      Module + 1000-line Class + 500-line Module live fixture against an
      Access COM oracle).
    • Re-exported from pyopenvba as AccessReader.
    • Write path (re-compress + re-allocate LVAL pages) is not implemented;
      Access support is read-only by design.

Changed

  • BREAKING: Renamed pyopenvba.access module to pyopenvba.access_read
    and renamed the AccessFile class to AccessReader to make the
    read-only access posture explicit.
  • Adopted strict static analysis: pyright typeCheckingMode = "strict"
    and a curated ruff lint configuration (E, F, W, B, UP, SIM, I, RUF, PIE, C4, PERF, N, TC, RET, TRY) now run clean across src/ and
    tests/ with 0 errors.

Removed

  • Pruned ~1800 lines of dead Access write-path / probe code and the
    associated tests that exercised never-public APIs.
No immediate action
v2.0.1 New feature

synthesize_class_header helper

No immediate action
v2.0.0 New feature

Word & PowerPoint file support

No immediate action
v1.1.1 Bug fix

Fix for header loss on edit

Weekly OSS security release digest.

The CVE patches and breaking changes that affected production tools this week. One email, every Sunday.

No spam, unsubscribe anytime.

About

Stars
26
Forks
0
Languages
Python PowerShell

Install & Platforms

Install via
pip
Platforms
linux macos windows

Alternative to

oletools olefile

Beta — feedback welcome: [email protected]