1.4 KiB
1.4 KiB
Access (.accdb) VBA Code Export/Import Support Design
Summary
Extend the existing extract_vba.py and import_vba.py to support Access .accdb files alongside Excel .xlsm files. The file type is auto-detected by extension via a unified TARGET_FILE env variable.
Key COM Differences
| Dimension | Excel (.xlsm) | Access (.accdb) |
|---|---|---|
| ProgID | Excel.Application |
Access.Application |
| Open | Workbooks.Open(path) |
OpenCurrentDatabase(path) |
| VBA Project | workbook.VBProject |
CurrentDb().VBE.VBProjects(1) |
| Close | workbook.Close() + Quit() |
CloseCurrentDatabase() + Quit() |
| Module types | Standard/Class/Document/Forms | Standard/Class only |
Changes
.env
- Replace
TARGET_XLSM_FILEwithTARGET_FILE(supports.xlsmand.accdb)
extract_vba.py
- Replace
TARGET_XLSM_FILEwithTARGET_FILE - Add
extract_vba_modules_access_com()method toVBAExtractor - Update
main()to detect file type by extension and auto-select COM method - Skip olevba option for
.accdbfiles (unsupported)
import_vba.py
- Replace
TARGET_XLSM_FILEwithTARGET_FILE - Add
import_vba_access()method toVBAImporter - Update
main()to detect file type by extension and route accordingly
Out of Scope
- Access Forms/Reports VBA code (user doesn't need it)
- olevba for Access files (unsupported)
- Directory structure changes (Modules/ClassModules sufficient)