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

177 views Asked by At

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?

1

There are 1 answers

7
SlowLearner On

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