Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Will renaming Visio's `ThisDocument` module cause any problems?

Tags:

vba

visio

vbide

The default Viso document has a CodeName of ThisDocument and unlike other Office documents, the ThisDocument component's CodeName appears to be Read Only.

If I have trusted access to the VBE, then I can rename the component, with a line like this:

ThisDocument.vbProject.vbComponents("ThisDocument").Name = "FooBar"

And from that point on, I can refer to the object as FooBar instead of ThisDocument

But, presumably, the CodeName is Read-Only for a reason. I can't find any issues with renaming the object, so far, but I'm unsure if there might be some unexpected ramifications.

Is it safe/wise to rename the ThisDocument component?

like image 640
ThunderFrame Avatar asked Oct 30 '22 04:10

ThunderFrame


1 Answers

When the double click event of a shape is linked to a macro (as described here, to create a Macrobutton of sorts) things break. Tested with Visio 2010 - 64bit version.

Furthermore after reinstating the original name of ThisDocument...

  • FooBar.vbProject.vbComponents("FooBar").Name = "ThisDocument"

... everything worked again :)

linking shapes to macro

like image 124
SlowLearner Avatar answered Nov 15 '22 06:11

SlowLearner