https://github.com/Beakerboy/MS-OVBA
Create a vbaProject.bin file from VBA source files.
https://github.com/Beakerboy/MS-OVBA
Last synced: 3 months ago
JSON representation
Create a vbaProject.bin file from VBA source files.
- Host: GitHub
- URL: https://github.com/Beakerboy/MS-OVBA
- Owner: Beakerboy
- Created: 2023-01-09T14:24:31.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-24T20:09:31.000Z (3 months ago)
- Last Synced: 2024-11-24T21:19:54.679Z (3 months ago)
- Language: Python
- Homepage:
- Size: 814 KB
- Stars: 15
- Watchers: 4
- Forks: 3
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- jimsghstars - Beakerboy/MS-OVBA - Create a vbaProject.bin file from VBA source files. (Python)
README
[](https://coveralls.io/github/Beakerboy/vbaProject-Compiler?branch=main)
# vbaProject-Compiler
Create a vbaProject.bin file from VBA source files.## VBAProject Class
The vbaProject class contains all the data and metadata that will be used to create the OLE container.
```python
from vbaProjectCompiler.vbaProject import VbaProject
from vbaProjectCompiler.ole_file import OleFileproject = VbaProject()
thisWorkbook = DocModule("ThisWorkbook")
thisWorkbook.addFile(path)
project.addModule(thisWorkbook)ole_file = OleFile(project)
ole_file.writeFile(".")
```The VbaProject class has many layers of customization available. Forexample a librry referenece can be added to the project.
```python
codePage = 0x04E4
codePageName = "cp" + str(codePage)
libidRef = LibidReference(
"windows",
"{00020430-0000-0000-C000-000000000046}",
"2.0",
"0",
"C:\\Windows\\System32\\stdole2.tlb",
"OLE Automation"
)
oleReference = ReferenceRecord(codePageName, "stdole", libidRef)
project.addReference(oleReference)
```## oleFile Class
Users should not have to interact with the oleFile class. It's job is to extract the data from the vbaProject and turn it into a valid file. This includes deciding which data stream appears where, and applying different views to the models to save the data in the correct formats.
The oleFIle has two parts, a header and a FAT Sector Chain. This FAT chain stores multiple streams of data:
* Fat Chain Stream
* Directory Stream
* Minifat Chain Stream
* Minifat Data Stream
* Fat Data StreamThese are all different views of data from the following Models
* fatChain
* minifatChain
* directoryStream