vbaExcel
Quick Usage
- Export VBA code to
.basfiles. - Refactor the
.basfiles. - Re-import them into the
.xlsm.
Recommended Workflow
1) Export VBA
- Run the export script at
scripts/export_vba.py. - If VBA access fails, enable
AccessVBOMusingscripts/enable_vba_access.reg.
2) Refactor
- Edit the
.basfiles in VS Code (or in the VBA editor).
3) Re-import
⚠️ Always create a backup of the .xlsm file before importing — the import overwrites existing VBA modules and cannot be undone.
- Run
scripts/import_vba.pyto replace each module's code.
Important Notes
- Excel must be installed.
- Close Excel before exporting or importing.
- Always create an XLSM backup before importing changes.
Included Scripts
scripts/export_vba.py: exports VBA to.basfiles via VBScript and COM.scripts/import_vba.py: imports.basfiles back into the XLSM via COM.scripts/enable_vba_access.reg: enables programmatic access to VBA.
When to Use This Skill
- You want to extract VBA code for refactoring.
- You want to automate importing VBA code back into an XLSM.
- VBProject access is blocked and you need to enable it.