|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
Shape.Data1 Property (Visio)
Gets or sets the value of the Data1 field for a Shape object. Read/write.
Use the Data1 property to supply additional information about a shape. The property can contain up to 64 KB of characters. Text controls should be used with care with a string that is greater than 3,000 characters. Setting the Data1 property is equivalent to entering information in the Data 1 box in the Special dialog box (click Shape Name in the Shape Design group on the Developertab).
This Microsoft Visual Basic for Applications (VBA) macro shows how to set a shape's Data1, Data2, and Data3 properties. It prints the values of these properties in the Immediate window. You can also verify that these values have been set by opening the Special dialog box.
Public Sub Data123_Example() Dim vsoPage As Visio.Page Dim vsoShape As Visio.Shape Set vsoPage = Documents.Add("").Pages(1) Set vsoShape = vsoPage.DrawRectangle(3, 3, 5, 5) 'Use the Data1, Data2, and Data3 properties to set 'the shape's Data fields. vsoShape.Data1 = "Data1_String" vsoShape.Data2 = "Data2_String" vsoShape.Data3 = "Data3_String" 'Use the Data1, Data2, and Data3 properties to verify 'the shape's Data field values. Debug.Print vsoShape.Data1 Debug.Print vsoShape.Data2 Debug.Print vsoShape.Data3 End Sub