This project has been archived, please see BeakerBoy's vbaProject-Compiler instead for the continuation of thiis project / design.
This work-in-progress tool is designed to help developers create Excel macro-workbooks from source VBA .bas
, .cls
and .frm
files. This tool does not require Excel to be installed on the system running it, and operates fully outside of the VBE.
This project is based off the amazing work by EvilClippy.
Excel macro workbooks store VBA code in 2 parts. Optimised PCode
and Compressed Source
. If the Optimised PCode
part is missing (or incompatable with the running version of Excel) then the Compressed Source
is used to create a new set of Optimised PCode
. This tool intends to erase the Optimised PCode and Inject new compressed source code into the Excel workbook.
|- Libs //Hidden (background) modules
| |- STD
| | |- IEnumVariant.bas
| | |- stdArray.cls
| | |- stdDictionary.cls
| | |- stdCallback.cls
| | |- ...
| |
| |- JSONBag
| | |- JSONBag.cls
| | |- License.txt
| |
| |- VBA-WEB
| | |- Request.cls
| | |- UtcConverter.bas
|
|- Src //Project files (not hidden) modules
| |- ThisWorkbook.wkb
| |- Dashboard.sht
| |- ADMIN.sht
| |- Settings.sht
| |- HUDMain.bas
| |- HUD
| | |- HUDCore.cls
| | |- HUDUI.cls
| | |- HUDConnect.cls
| | |- HUDGraph.cls
| | |- HUDGraphNode.cls
| | |- HUDGraphEdge.cls
| | |- HUDGDI.bas
|
|- Input.xlsm
|- Output.xlsm
|- Setup.json
with Setup format:
{
"hideLibs":true,
"linker":[
{"codename":"Dashboard","file":"Dashboard.sht"}, //Using sheet codename
{"sheetIndex": 2,"file":"ADMIN.sht"}, //Using sheet index
{"sheetName":"SETTINGS", "file":"Settings.sht"} //Using sheet name
]
}
root
|- main.cs - Command line application which performs the above task using the VBA.cs library.
|- VBA.cs - Might rename to VBAProject.cs - Provides a base API for working with VBA workbooks. Can open existing workbooks or create from a template. Add modules to the project, remove them, hide them etc.
|- libs
| |- Kabod.Vba.Compression.cs - Provides implementation of VBA compression routine (so we can decompress and compress vba source code out of VB project.)
| |- options.cs - Library for working with commandline options?
| |- utils.cs - Small helpful functions
This project was designed as a stepping stone for making VBA projects easier to write and build in any IDE of your choosing. A number of key issues stand in the way of moving VBA projects out of the VBE and into custom development environments:
- A VBA code parser and language server - this is possibly going to be created by rubberduck.
- A VBA compiler / file reader - which this project aims to become.
- Userform Designer and builder - Unlikely we will ever get a full UserForm builder which generates .frm and .frx files but we might get a wrapper for UserForm with a custom editor. It is likely this will be a better system anyway, allowing for addition of components to UserForms. VBA STD library aims to achieve this.
- A VBA interpreter - would be helpful for testing.
- A
BNF -> AST -> VBA AST -> VBA
transpiler - this would allow us to parse custom code and translate it into official VBA code. - Depends on babel-like compiler - Proper error handling (with line number and stack traces), a VBA/VBE debugger http server, language extensions, optimised inline functions / lambda syntax, mixins, and more...
- VBAPackager - Sancarn
- EvilClippy - Stan Hegt (@StanHacked) / Outflank
- EvilClippy - Carrie Roberts (@OrOneEqualsOne / Walmart).
- EvilClippy - Nick Landers (@monoxgas / Silent Break Security) for pointing me towards OpenMCDF.