Visio) (Shape.GetLinkedDataRecordsetIDs 方法

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

注意事項

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

語法

expression。 GetLinkedDataRecordsetIDs( _DataRecordsetIDs()_ )

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

參數

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

傳回值

無

註解

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

範例

下列Microsoft Visual Basic for Applications (VBA) 巨集示範如何使用 GetLinkedDataRecordsetIDs 方法來取得包含連結至圖形之資料列的所有資料記錄集的識別碼。

執行此巨集之前,請至少將兩個資料記錄集新增至文件的 DataRecordsets 集合。 巨集會將圖形拖放到頁面上,將圖形連結至最近新增至集合的兩個資料記錄集中的資料,然後在立即視窗中列印 GetLinkedDataRecordsetIDs 方法所傳回的連結資料記錄集識別碼。

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