WilliamSmithEdward / pyOpenVBA
PublicPure-Python reader/writer for VBA macros embedded in Excel / PowerPoint / Word files. Zero dependencies, deterministic round-trip, safe on protected and signed projects.
pyOpenVBA is a pure-Python library that lets you read, edit, and write VBA macro code inside Excel, Word, and PowerPoint files without needing Microsoft Office installed. You can extract all the macro code from a document into separate text files on your computer, edit them using any text editor or script, and then put your changes back into the original file. The library is careful to produce files that will open cleanly in the regular Office applications, with built-in safety checks to prevent accidentally breaking password-protected or digitally-signed projects.
How It Works
You've been working with Excel, Word, or PowerPoint files that contain VBA code (macros). Maybe a colleague shared a spreadsheet with useful automation, or you inherited a library of macro-enabled templates.
The idea of opening each file in Microsoft Office, navigating to the VBA editor, and making changes by hand feels slow and error-prone. You wish you could manage these files like regular code in a text editor.
You find this library that lets you work with Office macro files using simple Python code, without needing Microsoft Office installed at all. You can read, modify, and save VBA code just like any other text file.
With a single command, all the VBA code from your Excel file is extracted to separate text files on your hard drive. Each module becomes its own file, organized and ready to edit.
Since the macros are now plain text files, you can use any editor you're comfortable with. You make your changes, fix bugs, or add new features just like writing regular code. You save the files when you're done.
Another single command takes all your edited files and puts them back into the original Office document. The library carefully rebuilds the file so it will still open properly in Excel, Word, or PowerPoint with no errors.
You open the file in the regular Office application and everything works exactly as expected. The macros are intact, the file opens without repair dialogs, and you've successfully managed your VBA code in a way that fits your normal development workflow.
Star Growth
Repurpose is a Pro feature
Generate ready-to-use prompts for X threads, LinkedIn posts, blog posts, YouTube scripts, and more -- with full repo context baked in.
Unlock RepurposeSimilar repos coming soon.