Select and Upload your Office file:
Output:
Notes
- Uploaded files will be deleted immediately. We do NOT store your files.
- This site is using an Office file parser to extract the VBA code, even if you don't know the password (for v.97-2003)
- The goal of this page is to make it very easy to extract VBA code from your Office files (Word, Excel).
- Word and Excel 97-2003
- Word/Excel/PowerPoint 2007-2019
- /!\ PowerPoint 97-2003 : Not supported
How to use?
More than easy, just select and upload your MS Office file. The VBA will appear in the "Output" part.
Example of output
A sample output:
Attribute VB_Name = "ThisDocument" Attribute VB_Base = "1Normal.ThisDocument" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = True Attribute VB_TemplateDerived = True Attribute VB_Customizable = True Private Sub Workbook_Open() MsgBox "Test" End Sub
VBA Macros storage overview
MS Office 97-2003
Most of them use the same underlying file format called Microsoft Compound File Binary (CFB) file format, or simply OLE2 file format.
An OLE file contains streams of data that look like files embedded within the OLE file. Each stream has a name. For example, the main stream of a MS Word document containing its text is named "WordDocument".
An OLE file can also contain storages which contains streams or other storages. For example, a MS Word document with VBA macros has a storage called "Macros".
The VBA source code is stored in one ore several streams located in the VBA storage (for example "ThisDocument" in the sample above). The code is not stored in clear text: It is compressed using a specific run-length encoding algorithm described in MS-OVBA.
VBA macros are normally contained in a VBA project structure, located in different places depending on the document type:
- Word 97-2003: in a storage called "Macros", at the root of the OLE file.
- Excel 97-2003: in a storage called "_VBA_PROJECT_CUR", at the root of the OLE file.
- PowerPoint 97-2003: VBA macros are stored within the binary structure of the presentation, not in an OLE storage.
MS Office 2007-2019
Also called MS Open XML, are quite different because they are made of XML files stored in Zip archives.
However, VBA macros are usually stored in a binary OLE file within the Zip archive, called "vbaProject.bin". Then the vbaProject.bin OLE file contains the same VBA project structure as described above for MS Office 97-2003 documents.
Here again, the vbaProject.bin file may be stored in different places in the Zip archive, depending on the document type:
- Word 2007+: word/vbaProject.bin
- Excel 2007+: xl/vbaProject.bin
- PowerPoint 2007+: ppt/vbaProject.bin