Modern Json in VBA - v3.0.0 Released
▲ 4 r/vba

Modern Json in VBA - v3.0.0 Released

Released earlier this year, ModernJsonInVBA parses JSON and writes it straight into Excel tables (ListObjects), and converts tables back to JSON roundtrip. It is pure VBA: no Scripting.Dictionary, no COM references, no external libraries. One call turns JSON text to a populated, refreshable table:

Excel_UpsertListObjectFromJsonAtRoot ws, "tOrders", ws.Range("A1"), jsonText, "$"

v3.0.0 split the engine into eleven modules and rewrote the parser and the Excel write path. I benchmarked it across seven payloads that vary in size and shape (flat rows, nested objects, escape-heavy strings, a 200-column wide table, numeric-heavy) and collected the results into a matrix.

Payloads

Payload Rows Cols Size
flat_10k 10,000 10 2.1 MB
nested_50k 50,000 9 9.2 MB
escapes_50k 50,000 6 14.8 MB
wide_5k_200c 5,000 200 16.0 MB
flat_100k 100,000 10 21.6 MB
numbers_200k 200,000 8 25.9 MB
flat_500k 500,000 10 109.5 MB

Timings (seconds) — rows are pipeline steps, columns are payloads:

Step flat_10k nested_50k escapes_50k wide_5k_200c flat_100k numbers_200k flat_500k
Read file 0.0273 0.0938 0.1523 0.1641 0.2227 0.2695 1.1289
Json_Parse (JSON to model) 0.2695 1.5586 1.3203 2.2344 2.3672 4.3984 11.8789
Json_Stringify (model to JSON) 0.2695 1.6719 1.4023 1.7266 2.5742 3.0430 12.9492
Upsert create (JSON to ListObject) 0.3281 2.4727 2.0625 2.8828 3.4727 4.7383 18.2656
Upsert refresh 0.3789 2.7422 2.3711 3.4844 3.9688 5.7305 20.3828
Export (ListObject to JSON) 0.1328 3.5195 0.9609 0.8477 1.3945 1.1484 7.1094

What the matrix shows:

  • 500,000 rows / 110 MB of JSON into a live Excel table in about 18 seconds (Upsert create). That is roughly 27,000 rows/sec, or ~275,000 cells/sec.
  • Small payloads are effectively instant: 10,000 rows loads in about a third of a second.
  • A raw block write of 5 million cells takes only a few seconds; most of the 18 s is parsing and shaping the JSON.
  • Upsert streams JSON straight into a 2D array for a root array (tableRoot = "$") and does not build an intermediate object model, so it keeps pace with a standalone parse plus a sheet write.

The benchmark machine is a Ryzen 7 9800X3D with 64-bit Excel, each cell is one wall-clock Timer run, and the payloads come from a seeded generator (deterministic). Times are hardware-dependent, so a typical office laptop will be slower. The whole table regenerates from the workbook with one macro (Run_JsonPerfMatrix), so you can produce your own numbers.

The library also does CSV and XML to JSON, JSONPath-style path resolution, schema evolution controls, and formula-preserving refreshes. Determinism is the design goal: stable column order, strict validation, and clear error numbers instead of silent guesses.

Repo (MIT): https://github.com/WilliamSmithEdward/ModernJsonInVBA

https://github.com/WilliamSmithEdward/ModernJsonInVBA/releases/tag/v3.0.0

Feedback is welcome.

u/MultiUserDungeonDev — 5 hours ago

Game Title: MudProto -- A Playable MUD (Multi User Dungeon) Framework

Game Title: mudproto

Playable Link: https://github.com/WilliamSmithEdward/mudproto

Platform: Any platform that can run python code

Description: I've been building a MUD framework from scratch in Python. One thing I finally got working in a way I’m happy with: full zones can be added as modular payloads now instead of being stitched in by hand across the codebase. Rooms, NPCs, gear, items, spells, skills, zone metadata, all loaded through the framework.

Free to Play Status:

  • [ X ] Free to play
  • [ ] Demo/Key available
  • [ ] Paid (Allowed only on Tuesdays with [TT] in the title)

Involvement: Sole owner / developer

reddit.com
u/MultiUserDungeonDev — 3 days ago
▲ 17 r/vba

I made a Python reference library for VBA/Office COM

pyVBAReference: static VBA / Office COM reference data

I built pyVBAReference, a Python package that extracts and ships VBA / Office COM reference data in tool-friendly formats.

The output includes:

  • JSON reference files
  • generated Markdown docs
  • a Python lookup API
  • a small CLI

The main use case is external tooling.

For example:

lookup Worksheet members
resolve method/property/event metadata
inspect parameters
find enum values
index Office object models
ground autocomplete or hover docs
support editor / LSP experiments

VBA has a lot of reference data available through COM type libraries and the Object Browser, but it is not especially convenient to consume outside the VBA IDE.

This repo is an attempt to make that data easier to query from Python and other tooling.

Repo:

https://github.com/WilliamSmithEdward/pyVBAReference

u/MultiUserDungeonDev — 1 month ago
▲ 9 r/vba

XLIDE: The Modern Development Environment for Excel VBA

Hello VBA community,

I built XLIDE, an MIT licensed open source VS Code extension for editing Excel VBA directly from .xlsm files.

You can open a workbook, browse its VBA modules, edit code in VS Code, use Go to Definition / Find References / Rename Symbol, and save changes back with Ctrl+S.

The read/write path does not use COM, Office automation, or win32com (quick shortcuts to open workbooks / run macros with F5 with COM are available though). It uses a Python backend with pyOpenVBA. It reads and writes directly to the VBA source package.

I also confirmed it works with VS Code Live Share, so two people can review or pair on workbook VBA without screen-sharing the VBE.

The other exciting part: XLIDE exposes workbook and VBA operations to Copilot agent tools. So an agent can list modules, read modules, inspect subs, read/write cells, export modules, and write changes back, with confirmation on write operations.

Many other features are also implemented.

Marketplace:
https://marketplace.visualstudio.com/items?itemName=WilliamSmithE.xlide

GitHub:
https://github.com/WilliamSmithEdward/xlide_vscode

Would love feedback from people who maintain VBA projects.

u/MultiUserDungeonDev — 1 month ago
▲ 51 r/vba+3 crossposts

Writing VBA modules inside Excel files is much stranger than I expected

Writing VBA back into Excel files is not “just editing text in a zip file”

I went down the rabbit hole of exploring how VBA modules are stored inside Office files, and the format is much stranger than I expected.

The most surprising part is how many layers are involved.

For a modern .xlsm file, the path looks roughly like this:

Excel workbook
  -> ZIP / Open XML package
    -> xl/vbaProject.bin
      -> Microsoft Compound File Binary
        -> VBA project streams
          -> compressed module source

So replacing a VBA module is not just:

open file
replace text
save file

It is closer to:

preserve the workbook container
extract vbaProject.bin
parse the compound file
decompress the VBA streams
find the real source offset
replace only the source body
recompress it correctly
invalidate Office caches
drop stale compiled-cache streams
avoid breaking protected or signed projects
put everything back without touching unrelated bytes

A few details made this more interesting than expected:

  • the dir stream is itself compressed
  • module source does not always start at byte zero
  • VBA source uses the project codepage, not UTF-8
  • short final compression chunks cannot be written as raw chunks
  • Office stores compiled cache streams that should not be rewritten
  • digital signatures become invalid after source changes
  • the real test is “does Excel reopen it without a "your workbook is broken" prompt?”

The main lesson:

Editing VBA inside Office files is not just editing a script file inside of a zip file. It's way more complicated. You have to maintain a small filesystem, a compression format, a project manifest, and a set of Office-specific safety rules at the same time.

Implementation guide:

https://github.com/WilliamSmithEdward/pyOpenVBA/blob/main/docs/ms-ovba-implementation-guide_v2.md

References:

  • Microsoft MS-OVBA specification
  • Microsoft Compound File Binary format
  • Office Open XML package structure
  • Real Excel workbooks tested against Excel for Microsoft 365
github.com
u/MultiUserDungeonDev — 3 days ago
▲ 59 r/vba

pyOpenVBA — a pure-Python, zero-dependency reader/writer for VBA macros in .xlsm / .xlsb / .xlam / .xls

Hi all,

I just released pyOpenVBA, a free, open-source tool that:

  • Pulls every module out of an .xlsm / .xlsb / .xlam / .xls as a regular .bas / .cls / .frm file.
  • Lets you edit them in any editor and version them in git.
  • Pushes them back into the workbook (opens in Excel with no repair dialog).
  • Supports add / rename / delete of modules.
  • Works with password-protected and signed projects.

I built it in pure Python, with no dependencies. No Excel install is needed (e.g. doesn't use COM at all) (works on Windows, macOS, Linux). MIT licensed.

UserForm layout editing is out of scope; code-behind edits work fine.

Feedback and weird workbooks that break it are very welcome.

reddit.com
u/MultiUserDungeonDev — 1 month ago