共用方式為


Shape.GetCustomPropertiesLinkedToData method (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 (自訂屬性填充 shape-data-item 的列 ID,) 形狀的 ShapeSheet 中連結到資料集中的資料欄位的列。

傳回值

註解

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

注意事項

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

範例

以下 Microsoft Visual Basic for Applications (VBA) 巨集 示範如何使用 GetCustomPropertiesLinkedToData 方法取得 shape-data-item (自訂屬性的 ID,並將其連結到資料集中的資料欄位) 列。

在執行此巨集前,至少將一個資料記錄集加入文件的 DataRecordsets 集合。 巨集會先將一個形狀放入頁面,將該形狀連結到最近加入集合的資料記錄集中的資料,然後測試是否連結成功。 如果是,它會取得所有連結到資料的 ShapeSheet 列的列 ID,並在即時視窗中列印列的 ID。

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 支援與意見反應