BB code in posts seems to be working again!
I haven't turned on every single tag, so please let me know if there are any that are used/needed but not activated.

Main Menu

VBA Document_DocumentOpened event on stencil triggers only once.

Started by JuneTheSecond, April 02, 2016, 11:53:47 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


I am using Visio 2016 pro for Office 365.
My stencil is saved in "My stencil" folder.
It has VBA macro only for Document_DocumentOpened event in ThisDocumemt module.

Option Explicit

Private Sub Document_DocumentOpened(ByVal doc As IVDocument)
    MsgBox doc.Name & " opened!"
End Sub

When I start Visio application, create a blank new drawing, open this stencl by clicking a menu "Other Shapes"/ "My Shapes! in shapes window, then the Document_DocumentOpened event triggers normally.
But when I close this stencil and open again in the same manner, the event never triggers.

I don't remember this is the same as in previous versions of Visio.
Am I missing something important?
Best Regards,

Junichi Yoda


Just tested: absolutely no problem with your scenario in V2013.


Thank you , Yacine.
Then it may be a bug in Visio 2016 pro for Office 365.
You had better wait buying until bug is fixed.
Best Regards,

Junichi Yoda


Now, I am getting around this problem setting My Shapes folder as a trusted location.
I am referring to a document at .
But I am afread the security level is lower than before.
Best Regards,

Junichi Yoda


JuneTheSecond did Visio open the stencil in protected mode, and was this the reason Document_DocumentOpened didn't start when the stencil was opened?
Visio 2021 Professional

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 225 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1106KB.
Tokens: post-login.
Cache hits: 13: 0.00152s for 26,764 bytes (show)
Cache misses: 2: (show)
Queries used: 16.

[Show Queries]