Expand description
An Office VBA project parser written in 100% safe Rust.
This is a (partial) implementation of the [MS-OVBA]: Office VBA File Format Structure protocol (Revision 9.1, published 2020-02-19).
The main entry point into the API is the Project
type, returned by the
open_project
function.
§Usage
Opening a project:
use std::fs::read;
use ovba::open_project;
let data = read("vbaProject.bin")?;
let project = open_project(data)?;
A more complete example that dumps an entire VBA project’s source code:
use std::fs::{read, write};
use ovba::open_project;
let data = read("vbaProject.bin")?;
let project = open_project(data)?;
for module in &project.modules {
let src_code = project.module_source_raw(&module.name)?;
write("./out/".to_string() + &module.name, src_code)?;
}
The API also supports low-level access to the [MS-CFB]: Compound File Binary File Format data. The following example lists all CFB entries:
use std::fs::read;
use ovba::open_project;
let data = read("vbaProject.bin")?;
let project = open_project(data)?;
for (name, path) in &project.list()? {
println!(r#"Name: "{}"; Path: "{}""#, name, path);
}
Structs§
- Information
- Specifies version-independent information for the VBA project.
- Module
- Specifies data for a module.
- Project
- Represents a VBA project.
- Reference
Control - Specifies a reference to a twiddled type library and its extended type library.
- Reference
Original - Specifies the identifier of the Automation type library the containing
ReferenceControl
’s twiddled type library was generated from. - Reference
Project - Specifies a reference to an external VBA project.
- Reference
Registered - Specifies a reference to an Automation type library.
Enums§
- Error
- Public error type.
- Module
Type - Specifies the containing module’s type.
- Reference
- Specifies a reference to an Automation type library or VBA project.
- SysKind
- Specifies the platform for which the VBA project is created.
Functions§
- open_
project - Opens a VBA project.
Type Aliases§
- Result
- A type alias for
Result<T, ovba::Error>
.