AlternateNames Property [Visio 2003 SDK Documentation]
Gets or sets the alternate names for a document.
strRet = object**.AlternateNames**
object**.AlternateNames** = strExpression
strRet String. One or more file names delimited by semicolons.
object Required. An expression that returns a Document object.
strExpression Required String. One or more file names delimited by semicolons. For example, "My Shapes 99.vss"; "My Shapes 98.vss".
Version added
2000
Remarks
The application stores document names in the following situations:
- Templates store stencil names. For example, the Basic Flowchart template stores the names of the Basic Flowchart Shapes.vss and Backgrounds.vss stencils. These stencils are opened with the Basic Flowchart template.
- Master shortcuts store stencil names. For example, a shortcut for the Data shape stores the name of the stencil on which the Data shape is stored—Basic Flowchart Shapes.vss.
When the application opens a document or accesses the Document object's collection, it uses the document name. If Microsoft Visio can't find the document name, it looks for alternate names for those stencils that are in the correct path. (To add a path, on the Tools menu, click Options, click the Advanced tab, and then click File Paths.) For example, suppose you created the stencil named "New Shapes 2003.vss." The following year you revised the stencil and renamed it "New Shapes 2004.vss." Any templates that opened New Shapes 2003.vss should now open New Shapes 2004.vss. To do this, set the AlternateNames property of New Shapes 2004.vss to "New Shapes 2003.vss." The following Microsoft Visual Basic code shows one way to do this:
Visio.Documents("New Shapes 2004.vss").AlternateNames = "New Shapes 2003.vss"
The AlternateNames property is empty until you set it by using Automation. Each of the alternate names in the string should contain the file name, but no folder information. You can also include comments in angle brackets (<>), because the application ignores anything in angle brackets. For example, you could use the following code to set the AlternateNames property:
Visio.Documents("HRShapes.vss").AlternateNames = "Human Resources Shapes.vss; <old name> HRDept Shapes.vss"
Example
The following macro shows how to get and set the AlternateNames property of the current document. It demonstrates that the property is empty until you set it.
Public Sub AlternateNames_Example()
'Get the AlternateNames property of the document.
Debug.Print "Alternate name is: "; ThisDocument.AlternateNames
'Set the AlternateNames property of the document.
ThisDocument.AlternateNames = "Test Shapes.vss"
Debug.Print "Alternate name is: "; ThisDocument.AlternateNames
End Sub
Applies to | Document object