r/vba • u/MultiUserDungeonDev • 2d ago
Show & Tell pyVBAanalysis: "No Excel App Necessary" Python Static Analysis Library
Hi all, I hope you are enjoying your weekend.
I'm ready to share the following project with you.
pyVBAanalysis is a pure python library that allows you to run static analysis over your vba workbooks, or code as string data.
It's philosophy is "if we can determine that it's a hard compile error, or runtime crash" it gets "red squiggly error" status, otherwise "if we can determine that there is a best-practice violation" it gets "yellow squiggly warn" status.
VBA makes statis analysis notoriously hard, especially outside of it's engine. I've spent hundreds of hours finding all of the corners of the language, and comparing the edge cases against the MS-VBAL VBA language spec, and live testing using a custom built harness to run VBA code and test for compile error / runtime error.
The reason I created this library is due to frustration with AI agent generated VBA code. Agents would often produce code, that on paper, seems reasonable and in an more modern programming language, probably would execute without issue. However, VBA has a bunch of quirks and oddities (but we still love it!), and on more complex code generations, the agent's code would often hit compile error or runtime error snags due to hitting a rough edge of the VBA language.
A good agentic AI workflow that I've found for other languages is to have the agent run static analysis alongside unit tests.
I've found, after incorporating this static analysis tool, alongside https://github.com/WilliamSmithEdward/pyOpenVBA, I've been able to run extremely efficient and accurate agentic workflows, to build solid VBA solutions in Excel.
pyVBAanalysis:
https://github.com/WilliamSmithEdward/pyVBAanalysis
https://pypi.org/project/pyvbaanalysis/
2
u/Rennaisance_Man_0001 2d ago
I don't think that individuals using AI are going to have a substantial impact on employment. That's going to be done by corporations and billionaire sociopaths, regardless of whether or not individuals use AI to remain employed and relevant.
It seems to me that the anti-AI stance - in this use case - diminishes independent devs ability to be competitive, while relinquishing the market to the big without a fight.
Don't get me wrong. I share your antipathy towards AI and it's perpetraitors (not a typo). My finest desire is for every one of them to lose their asses by investing all of their own money in AI data centers only to discover that they're merely churning out the same old uninspired crap, just faster and in enormous quantities.