共用方式為


Shape.GetCustomPropertiesLinkedToData 方法 (Visio)

會取得圖形之 Shape Data 區段中圖形資料項目 (自訂屬性) 列的識別碼,而該圖形的 ShapeSheet 試算表已與指定的資料記錄集連結。

注意事項

This Visio object or member is available only to licensed users of Visio Professional 2013.

語法

expressionGetCustomPropertiesLinkedToData( _DataRecordsetID_ , _CustomPropertyIndices()_ )

表達 會傳回 Shape 物件的運算式。

參數

名稱 必要/選用 資料類型 描述
DataRecordsetID 必要 Long 包含圖形所連結之資料的資料記錄集識別碼。
CustomPropertyIndices () 必要 Long 輸出參數。 空的無維度陣列,方法會填入 shape-data-item 的資料列識別碼, (自訂屬性) 圖形 ShapeSheet 中連結到資料記錄集中資料行的資料列。

傳回值

註解

了解圖形如何連結到資料,可以避免在重新整理一個或多個資料記錄集內的資料時發生衝突及中斷連結。

注意事項

在一些舊版的 Visio 中,「圖形資料」是稱為「自訂屬性」。

範例

下列 Microsoft Visual Basic for Applications (VBA) 宏會示範如何使用 GetCustomPropertiesLinkedToData 方法來取得圖形資料項目的識別碼, (自訂屬性) 連結至資料記錄集中資料行的資料列。

執行此宏之前,請至少將一個資料記錄集新增至檔的 DataRecordsets 集合。 宏會將圖形放到頁面上、將圖形連結至最近新增至集合之記錄集中的資料,然後測試以確定連結成功。 如果是,它會取得連結至資料之所有 ShapeSheet 資料列的資料列識別碼,會在 [即時運算] 視窗中列印資料列的識別碼。

Public Sub GetCustomPropertiesLinkedToData_Example() 
 
    Dim vsoDataRecordset As Visio.DataRecordset 
    Dim vsoShape As Visio.Shape 
    Dim intCount As Integer 
    Dim boolIsLinked As Boolean 
    Dim alngIndices() As Long 
    Dim intArrayIndex as Integer 
            
    intCount = Visio.ActiveDocument.DataRecordsets.Count 
    Set vsoDataRecordset = Visio.ActiveDocument.DataRecordsets(intCount) 
    Set vsoShape = ActivePage.DrawRectangle(2, 2, 4, 4) 
         
    vsoShape.LinkToData vsoDataRecordset.ID, 1, True 
    boolIsLinked = vsoShape.IsCustomPropertyLinked(vsoDataRecordset.ID, 1) 
     
    If boolIsLinked Then 
         
        vsoShape.GetCustomPropertiesLinkedToData vsoDataRecordset.ID, alngIndices 
        For intArrayIndex = LBound(alngIndices) To UBound(alngIndices) 
             Debug.Print alngIndices(intArrayIndex) 
        Next 
     
    Else 
     
        Debug.Print "Not linked." 
         
    End If 
 
End Sub

支援和意見反應

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