Shape.GetLinkedDataRow method (Visio)

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

Note

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

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.

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

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.