37 lines
1.4 KiB
Markdown
37 lines
1.4 KiB
Markdown
# 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_FILE` with `TARGET_FILE` (supports `.xlsm` and `.accdb`)
|
|
|
|
### extract_vba.py
|
|
- Replace `TARGET_XLSM_FILE` with `TARGET_FILE`
|
|
- Add `extract_vba_modules_access_com()` method to `VBAExtractor`
|
|
- Update `main()` to detect file type by extension and auto-select COM method
|
|
- Skip olevba option for `.accdb` files (unsupported)
|
|
|
|
### import_vba.py
|
|
- Replace `TARGET_XLSM_FILE` with `TARGET_FILE`
|
|
- Add `import_vba_access()` method to `VBAImporter`
|
|
- 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)
|