Table of contents
TOC
Collapse the table of content
Expand the table of content

Shape.GetLinkedDataRow Method (Visio)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

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

NameRequired/OptionalData TypeDescription
DataRecordsetIDRequiredLongThe 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
© 2017 Microsoft