Skip to main content

pyVBAReference

PyPI version Python versions Downloads CI Security Malware scan OpenSSF Scorecard License: MIT

A complete, machine-generated reference of the VBA (Visual Basic for Applications) object models for Excel, PowerPoint, Word and Access, plus the nine shared COM type libraries every host can reference. Every public type is exported as both human-readable Markdown and machine-readable JSON.

Layout

All generated data lives under reference/ to keep the repo root clean:

reference/
  agentic_llm_primer.md  guide for AI agents (schema + grounding)
  index.json             master catalog of every library and type
  members.json           member name -> the types that define it
  <library>/
    md/     one .md per type   + _index.md
    json/   one .json per type + _index.json
  consolidated/          the same data folded into one set of files per app
    <app>.json / .md             every type
    <app>_constants.json / .md   every enumeration and module constant
    <app>_properties.json / .md  every property of every object

Both md/ and json/ hold the same data: signatures, return types, parameter lists, property access modes, enum values, remarks, and examples - introspected from the registered COM type libraries and enriched with descriptions from Microsoft Learn.

Libraries

Host applications:

Folder Library Types
excel Microsoft Excel 16.0 Object Library 1028
word Microsoft Word 16.0 Object Library 750
powerpoint Microsoft PowerPoint 16.0 Object Library 339
access Microsoft Access 16.0 Object Library 289

Shared libraries, referenceable from any host:

Folder Library Types
office Microsoft Office 16.0 Object Library 510
msforms Microsoft Forms 2.0 Object Library 166
adodb Microsoft ActiveX Data Objects 6.1 Library 110
msxml Microsoft XML, v6.0 101
vbide Microsoft Visual Basic for Applications Extensibility 45
scripting Microsoft Scripting Runtime 28
vba Visual Basic For Applications (language built-ins) 26
stdole OLE Automation 11
winhttp Microsoft WinHTTP Services, version 5.1 7

VBA language built-ins (MsgBox, Format, CStr, vbCrLf, ...) live in the vba library, grouped into modules such as Interaction and Strings.

A type name that exists in several hosts (Application, Range, Font, ...) resolves to the Excel one first; pass a library to pick another (vba.get_type("Application", "word")).

Finding something

  • Don't know which type owns a member? Check reference/members.json - it maps every member name to the types that define it.
  • Want the full catalog? See reference/index.json - all libraries and types.
  • Know the type name? Open reference/<library>/md/<TypeName>.md.
  • Browsing one library? Start at reference/<library>/md/_index.md.
  • A global function (e.g. MsgBox)? It's in a module under reference/vba/ - MsgBox is in reference/vba/md/Interaction.md.
  • A constant's value (e.g. xlCSV)? See the enum file, e.g. reference/excel/md/XlFileFormat.md.
  • Want one file instead of a folder tree? See reference/consolidated/ below.

Consolidated exports

reference/consolidated/ holds the same data folded into one set of files per application - Excel, PowerPoint, Word, Access, and shared for the libraries all four have in common. Each set is three pairs of files:

File Contents
<app>.json / .md every type, with methods, events and parameter docs
<app>_constants.json / .md / .csv every enumeration and module constant, with values
<app>_properties.json / .md / .csv every property of every object, with type and access

The two CSVs are flat tables for importing into a spreadsheet. Properties, as Object,Property,Property split,Type,Access:

Application,ActiveCell,Active Cell,Range,R_O
Worksheet,UsedRange,Used Range,Range,R_O
Worksheet,Name,Name,String,V

Property split is the same name split at capitals, for reading rather than calling. Access is R_O read-only, V settable, W_O write-only.

Constants, as Owner,Kind,Constant,Value,Description:

XlFileFormat,Enumeration,xlCSV,6,CSV
XlFileFormat,Enumeration,xlWorkbookDefault,51,Workbook default
Constants,Module,vbCrLf,Chr(13) & Chr(10),

Value is written as a VB6 literal, so it drops straight into generated code: bare numbers, quoted strings, and Chr() for the handful of constants whose value is a control character. 26,543 property rows and 12,995 constant rows across the ten files.

So the whole Word object model is one 3.6 MB JSON file or one 1.8 MB Markdown file; every Excel constant is a 175 KB Markdown file. Nothing here is new data - it is the per-type files concatenated, for grep, download, or feeding to a model. Start at reference/consolidated/_index.md.

Regenerating

Requires Windows with the relevant Office applications installed and pywin32 (pip install -e ".[generate]"):

.venv\Scripts\python.exe scrape_excel_object_model.py

Flags: --no-enrich (signatures only, skip Microsoft Learn text), --refresh-docs (force re-download of the documentation corpus), and --only word,powerpoint (rebuild just those libraries; the master indexes and consolidated exports still cover everything else).

The consolidated exports are rebuilt at the end of every run. To rebuild only them - no Office or pywin32 needed, just the generated JSON:

python consolidate_reference.py

For AI agents

See agentic_llm_primer.md for the JSON schema and guidance on grounding VBA code against this reference.

Python library

The same data is exposed as an installable, typed Python package, vba_reference. The JSON is bundled into the wheel, so an installed copy is self-contained; in this repo it reads the generated folders directly.

pip install -e .          # from this repo (editable)
# or: pip install vba-reference
import vba_reference as vba

vba.library_names()                          # ['excel', 'powerpoint', 'word', ...]
ws = vba.get_type("Worksheet")               # TypeDoc (case-insensitive)
print(ws.remarks)
protect = ws.member("Protect")               # Member
[(p.name, p.optional) for p in protect.parameters]

vba.get_type("Document", "word")              # disambiguate by library
vba.locate_type("Application")                # every host that defines it
vba.find_members("MsgBox")                    # -> [MemberRef(library='vba', type='Interaction', ...)]
vba.find_members("SaveAs")                    # every type that defines SaveAs
vba.get_constant("XlFileFormat", "xlCSV").value   # 6
vba.get_constant("WdSaveFormat", "wdFormatPDF").value  # 17

Command-line interface (vba-ref once installed, or python -m vba_reference):

vba-ref libs                     # list libraries and type counts
vba-ref where MsgBox             # where a member/type is defined
vba-ref type Worksheet           # full type entry
vba-ref member Worksheet Protect # one member with parameter docs

Security

Every push to main, every pull request and every release is scanned with CodeQL, Semgrep, ClamAV and YARA-X, and again daily. The build fails on anything that is not a reviewed, documented exception. Each release carries its security report as an attached file. To report a vulnerability privately, and for what is scanned and how, see SECURITY.md.

License and attribution

The code in this repository is MIT licensed - see LICENSE. The attribution for the documentation text in the data is in THIRD_PARTY_NOTICES.md, and both files ship in the package.

The generated data is two things with two origins. Type names, member signatures, parameter lists, property access modes and enumeration values are introspected from the COM type libraries themselves. The prose - descriptions, remarks and code examples - comes from MicrosoftDocs/VBA-Docs, published by Microsoft Corporation under CC BY 4.0 with its code samples under the MIT License. It is redistributed here under CC BY 4.0 with attribution to Microsoft.

This project is not affiliated with or endorsed by Microsoft.

Metadata

Release files for vba-reference 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vba-reference 1.0.1
File Size Uploaded
vba_reference-1.0.1.tar.gz 1.8 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for vba-reference 1.0.1
File Interpreter ABI Platform
vba_reference-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 5.5 MB

Release files / vba_reference-1.0.1.tar.gz

Download URL vba_reference-1.0.1.tar.gz
Size 1.8 MB
Tags Source
SHA-256 checksum
How to use checksums
5aba0319b3291e306ffbfd775baf04fb314f292994aac4a618ad4a043140bbd2
BLAKE2b-256 checksum
How to use checksums
7367ec35288e55df4b8d2f561d2e28f11c0c7c5b187204732782160f089b6822
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.

Transparency log

Release files / vba_reference-1.0.1-py3-none-any.whl

Download URL vba_reference-1.0.1-py3-none-any.whl
Size 3.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
4395a015cfa7df29f6ad0d8546cd87acf6388b22885056d83ec9c3797816ec1a
BLAKE2b-256 checksum
How to use checksums
e4648157a471d839a5e3345d2f03ccfe0bce7146e2d9ae58244d283564b6a988
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page