Sharing custom code
All Visio documents can contain VBA code, but they must be saved with one of the macro-enabled extensions. Often, the best location for custom VBA code is in a stencil, saved with a VSSM extension. This is because it can be easily opened for read-only purposes by multiple documents and users.
This book has companion VBA code in a Visio stencil called Mastering Data.vssm
. The project name, Mastering_Data
, and other values can be set in the Project Properties dialog opened from the Tools menu.

VBA projects can also be locked with a password on the Protection tab of the Project Properties dialog, as shown in the next screenshot:

Locking code prevents idle tampering, but there are VBA password hacks available online.
The VBA project in a Visio document can also be signed with a digital signature, as shown in the following screenshot of the dialog opened by Tools | Digital Signature:

If a VBA project has a digital certificate applied to it, then it will automatically be removed...