Shape.GetLinkedDataRow Method (Visio)

Office 2013 and later

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

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

Note Note

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

expression .GetLinkedDataRow(DataRecordsetID)

expression An expression that returns a Shape object.




Data Type





The ID of the data recordset that contains the linked row.

Return Value


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

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.

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