Shape.GetLinkedDataRecordsetIDs Method

Visio Automation Reference

Gets the IDs of all the data recordsets that contain data rows linked to the shape.

ms195704.vs_note(en-us,office.12).gif  Note
This Visio object or member is available only to licensed users of Microsoft Office Visio Professional 2007.

Version Information
 Version Added:  Visio 2007

Syntax

expression.GetLinkedDataRecordsetIDs(DataRecordsetIDs())

expression   An expression that returns a Shape object.

Parameters

Name Required/Optional Data Type Description
DataRecordsetIDs() Required Long Out parameter. An array of IDs of data recordsets containing data rows linked to the shape.

Return Value
Nothing

Remarks

For the DataRecordsetIDs() parameter, pass an empty, dimensionless array of type Long that the method fills with the IDs of data recordsets containing data rows linked to the shape.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the GetLinkedDataRecordsetIDs method to get the IDs of all the data recordsets that contain data rows linked to the shape.

Before running this macro, add at least two data recordsets to the DataRecordsets collection of the document. The macro drops a shape onto the page, links the shape to data in the two data recordsets most recently added to the collection, and then prints the IDs of the linked data recordsets returned by the GetLinkedDataRecordsetIDs method in the Immediate window.

Visual Basic for Applications
  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

See Also