共用方式為


Shape.GetCustomPropertyLinkedColumn method (Visio)

會取得圖形中圖形資料 (自訂屬性) 列所連結的資料欄名稱,而該圖形的 ShapeSheet 試算表是由自訂屬性索引所指定。

注意事項

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

語法

expressionGetCustomPropertyLinkedColumn( _DataRecordsetID_ , _CustomPropertyIndex_ )

一個回傳 Shape 物件的表達式。

參數

名稱 必要/選用 資料類型 描述
DataRecordsetID 必要 Long 包含連結至圖形自訂屬性之資料欄的資料記錄集識別碼。
CustomPropertyIndex 必要 Long 連結至資料記錄集中資料欄之圖形資料項目 (自訂屬性) 的索引。

傳回值

字串

註解

如果方法失敗,請呼叫 Shape.IsCustomPropertyLinked 方法,確認自訂屬性列 (的 shape 資料項目確實連結到資料欄位) 。

注意事項

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

範例

下列 Microsoft Visual Basic for Applications (VBA) 巨集會示範如何使用 GetCustomPropertyLinkedColumn 方法,來取得連結至特定圖形資料項目之資料記錄集資料欄的名稱。

在執行此巨集前,至少將一個資料記錄集加入文件的 DataRecordsets 集合。 巨集會先將一個形狀放入頁面,將該形狀連結到最近加入集合的資料記錄集中的資料,然後測試是否連結成功。 如果是,它會在立即視窗中列印與指定形狀資料項目相關的資料記錄集欄位名稱, (自訂屬性) 。

Public Sub GetCustomPropertyLinkedColumn_Example() 
 
    Dim vsoDataRecordset As Visio.DataRecordset 
    Dim vsoShape As Visio.Shape 
    Dim intCount As Integer 
    Dim boolIsLinked As Boolean 
    Dim lngIndex As Long 
    Dim strColumnName As String 
         
    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 
     
        strColumnName = vsoShape.GetCustomPropertyLinkedColumn(vsoDataRecordset.ID, 1) 
        Debug.Print "Linked column name is", strColumnName 
     
    Else 
     
        Debug.Print "Not linked." 
         
    End If 
 
End Sub

支援和意見反應

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