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?
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...
... everything worked again :)