共用方式為


Shape.GetLinkedDataRecordsetIDs method (Visio)

會取得所有包含連結至圖形之資料列的資料記錄集識別碼。

注意事項

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

語法

expressionGetLinkedDataRecordsetIDs( _DataRecordsetIDs()_ )

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

參數

名稱 必要/選用 資料類型 描述
DataRecordsetIDs () 必要 Long 輸出參數。 包含連結至圖形之資料列的資料記錄集識別碼陣列。

傳回值

註解

如果是 DataRecordsetIDs() 參數,請傳遞 Long 類型、無維度的空陣列,方法會在其中填入包含連結至圖形之資料列的資料記錄集識別碼。

範例

以下Microsoft Visual Basic for Applications (VBA) 巨集示範如何使用 GetLinkedDataRecordsetIDs 方法取得所有包含與該形狀連結資料列的資料記錄集的 ID。

在執行此巨集前,至少將兩個資料記錄集加入文件的 DataRecordsets 集合。 巨集會在頁面上放置一個形狀,將該形狀連結到最近加入收藏的兩個資料記錄集中的資料,然後在即時視窗中列印 GetLinkedDataRecordsetIDs 方法回傳的連結資料集的 ID。

Public Sub GetLinkedDataRecordsetIDs_Example() 
 
    Dim vsoDataRecordset1 As Visio.DataRecordset 
    Dim vsoDataRecordset2 As Visio.DataRecordset 
    Dim vsoShape As Visio.Shape 
    Dim intCount As Integer 
    Dim alngDataRecordsetIDs() As Long 
    Dim intArrayIndex As Integer 
     
    intCount = Visio.ActiveDocument.DataRecordsets.Count 
    Set vsoDataRecordset1 = Visio.ActiveDocument.DataRecordsets(intCount) 
    Set vsoDataRecordset2 = Visio.ActiveDocument.DataRecordsets(intCount - 1) 
     
    Set vsoShape = ActivePage.DrawRectangle(2, 2, 4, 4) 
         
    vsoShape.LinkToData vsoDataRecordset1.ID, 1, True 
    vsoShape.LinkToData vsoDataRecordset2.ID, 2, True 
         
    vsoShape.GetLinkedDataRecordsetIDs alngDataRecordsetIDs 
         
    For intArrayIndex = LBound(alngDataRecordsetIDs) To UBound(alngDataRecordsetIDs) 
        Debug.Print alngDataRecordsetIDs(intArrayIndex) 
    Next 
         
End Sub

支援和意見反應

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