Share via


Shape.GetLinkedDataRow Method

Visio Automation Reference

Gets the ID of the data row in the specified data recordset linked to the shape. .

ms195705.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.GetLinkedDataRow(DataRecordsetID)

expression   An expression that returns a Shape object.

Parameters

Name Required/Optional Data Type Description
DataRecordsetID Required Long The ID of the data recordset that contains the linked row.

Return Value
Long

Remarks

The GetLinkedDataRow method fails if the shape is not linked to a data row.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the GetLinkedDataRow method to get the ID of the data row in the specified data recordset linked to the shape.

Before running this macro, add at least one data recordset to the DataRecordsets collection of the document. The macro drops a shape onto the page, links the shape to a data row in the data recordset most recently added to the collection, gets the ID of the row, and then prints the ID of the row in the Immediate window.

Visual Basic for Applications
  Public Sub GetLinkedDataRow_Example()
Dim vsoDataRecordset As Visio.DataRecordset
Dim vsoShape As Visio.Shape
Dim intCount As Integer
Dim lngRowID As Long

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
       
lngRowID = vsoShape.GetLinkedDataRow(vsoDataRecordset.ID)
Debug.Print lngRowID
    

End Sub

See Also