共用方式為


Shape.Data2 property (Visio)

取得或設定 Shape 物件 Data2 欄位的值。 讀取/寫入。

語法

expressionData2

expression 一個用於表示 Shape 物件的變數。

傳回值

字串

註解

使用 Data2 屬性可提供圖形的其他資訊。 此屬性最多可包含 64 KB 的字元。 使用大於 3,000 個字元的字串時,應謹慎使用文字控制項。 設定 Data2 屬性相當於在特殊對話框中輸入資訊 (在開發者標籤的 Shape Design 群組中點選 Shape Name) 。

範例

這個 Microsoft Visual Basic for Applications (VBA) 巨集示範如何設定圖形的 Data1Data2Data3 屬性。 此巨集會列印 [即時運算] 視窗中的這些屬性值。 您也可以開啟 [特殊] 對話方塊,確認這些值都已經設定。

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

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應