Table of contents
Collapse the table of content
Expand the table of content

Shape.Data2 Property (Visio)

office 365 dev account|Last Updated: 6/12/2017
1 Contributor

Gets or sets the value of the Data2 field for a Shape object. Read/write.


expression . Data2

expression A variable that represents a Shape object.

Return Value



Use the Data2 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 Data2 property is equivalent to entering information in the Data 2 box in the Special dialog box (click Shape Name in the Shape Design group on theDevelopertab).


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
© 2017 Microsoft