VBA export

From The Document Foundation Wiki
Jump to: navigation, search

VBA export

Specifications

VBA file format is the main specification describing how the VBA stream looks like.

VBA in OOXML is the specification how the VBA stream is integrated into OOXML.

Tools

OLEToy is the preferred tool to inspect the VBA stream.

mso-dumper is the other way to dump the vba stream. For OOXML documents you first need to extract the vba stream through a zip application and then use vbadump.py on that file.

Code pointers

Import

VbaProject::readVbaModules in oox/source/ole/vbaproject.cxx is the starting point for the VBA import.

VbaModule::createModule and VbaModule::readSourceCode in vim oox/source/ole/vbamodule.cxx are the next interesting points.


Export

Currently all the work happens in the feature/vba-export branch. The export is currently implemented in oox/source/ole/vbaexport.cxx and should be called during the XLS and XLSX export.

For XLS the stream is already correctly integrated into the document. For XLSX we are still exporting the stream to a temporary file.

Random Notes

export non-VBA modules? (xVBACompatibility::setVBACompatibility)

xlsx vs xlsm?

doc, docx, ppt, pptx