Visio) (Shape.GetCustomPropertiesLinkedToData 方法

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

注意事項

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

語法

expression。 GetCustomPropertiesLinkedToData( _DataRecordsetID_ , _CustomPropertyIndices()_ )

運算式 傳回 Shape 物件的運算式。

參數

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

傳回值

無

註解

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

注意事項

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

範例

下列Microsoft Visual Basic for Applications (VBA) 巨集 示範如何使用 GetCustomPropertiesLinkedToData 方法取得 shape-data-item (自訂屬性的識別碼) 資料記錄集中資料行連結的資料列。

執行此巨集之前,請至少將一個資料記錄集新增至文件的 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 支援與意見反應。