Visio may break digital signature of VBA project, thus resulting in the message about "corrupted digital signature" (below screenshot)
The steps to reproduce the problem:
- Create a
digitally signed stencil with VBA macro (Stencil1.vss). Create a module there, say Module1, with a function called Sub1 doing nothing
- Create a
digitally signed drawing (Drawing1.vsd)
- Add a reference the stencil from the drawing (add reference to VSS) to VBA project. This is quite specific, and I have hardly seen anybody using this feature. Or maybe it's just me. To do that, open VBA IDE, then go to "Add reference..." and select the stencil created at the step 1 (Stencil1.vss). Yes, you can add references not only to DLLs but also to Visio files. Amazing.
- Use some code from the stencil in the drawing to make sure the reference is actually created. Add some function there like calling Module1.Sub1 in ThisDocument
- Save everything
- Try opening - should be fine.
- Now move stencil to another (accessible to Visio!) location. Like, to "My Shapes" for example (if before you created it in the same folder as the drawing)
- Open the drawing again (should be opened properly)
- Save ==>> Here is the problem. It looks like Visio
updates the VBA project with new referenced stencil path, thus breaking the digital signature. BOOM
- Close and open the drawing again. BOOM. Invalid digital signature



Could somebody please verify/confirm?
The easier steps (the files are attached, signature-issue.zip):
- Download and unzip the attached zip file (Drawing5.vsd + Stencil5.vsd)
- Open the drawing file. Visio prompts about security. Click "Trust all from publisher" (the publisher is me, you can remove that later)
- Close and open the file again. Should be opened fine, you should be able to see both diagram and stencil are signed (in the VBA Project)
- Save the file (<= here it breaks it), and close it.
- Open the file again => broken signature message.