This free Visio add-in helps to import and export VBA code from Visio to a folder.
The addin can exports and import the code from “ThisDocument”, forms (.frm), classes (.cls) and modules (.bas)
It may be handy if you want to track changes to the VBA code which is located in a template or a stencil. For example, you can compare it with previous versions, or put the exported folder under a source control, like GIT or TFS. So that you always know what was changed in comparison with the previous version.
|setup.exe||VBA Import/Export Addin (online)||414.9 KiB||06.03.2016|
|VisioImportExportVba.msi||VBA Import/Export Addin (offline)||872.0 KiB||06.03.2016|
The “online” version is a VSTO-based click once installer, with built-in auto-update. The “offline” installer is a self-sufficient, no connection to the internet required for the target machine (can be installed both per-user and per-computer). Note that for “offline” version in case if you are still using Visio 2007 you may need to install VSTO runtime and SP3
If you click “Export VBA“, the addin prompts you to select export folder, and writes VBA project content of the current document to that folder. The file names correspond to the VBA project items, such as forms/classes/modules. This document content is saved as “ThisDocument.bas”. The next time you click “Export VBA” the project will be re-exported to the same folder (the addin remembers last export folder). To specify another, you can click drop-down arrow and select it.
If you click “Import VBA“, the addin will prompt you to select folder with files on the disk. All files from this folder will be imported into the project, overriding what’s currently there. You can select for example the folder you exported your files to when using “Export VBA”
The option to “Include Sntecils” allows you to import/Export also code from the drawing’s stencil (can be selected only for templates and drawings). Means, the addin can also export/import code from the attached stencils (these are saved in sub-folders that correspond to the stencil names)
The option to “Clear Before Import” will remove all the content of the VBA project before importing (means, every vba component will be removed from the file), and then the content of the folder will be imported. Make sure you use that with care.
Requirements: Visio 2007 SP3 or above, NET 4 or above.
For the tool to work make sure you enable programmatic access to VBA project (in Visio security options). Otherwise you’ll get message that it’s disabled.
The addin is open-source:
Feel free to fire bugs there… 🙂