Export (0) Print
Expand All

Page.GetShapesLinkedToDataRow Method (Visio)

Published: July 16, 2012

Returns an array of all shapes on the active page linked to data in the specified data row in the specified data recordset.

Note Note

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

Version Added: Visio 2007

expression .GetShapesLinkedToDataRow(DataRecordsetID, DataRowID, ShapeIDs())

expression An expression that returns a Page object.

Parameters

Name

Required/Optional

Data Type

Description

DataRecordsetID

Required

Long

The ID of a data recordset contained in the current document.

DataRowID

Required

Long

The ID of a data row in the data recordset specified in DataRecordsetID.

ShapeIDs()

Required

Long

Out parameter. An array of type Long that the method will return filled with the shape IDs of shapes on the page linked to the data row specified in DataRowID in the data recordset specified in DataRecordsetID.

Return Value

Nothing

For the ShapeIDs() parameter, pass an empty, dimensionless array of type Long. If there are no shapes on the page linked to the data row specified by DataRowID in the data recordset specified by DataRecordsetID, GetShapesLinkedToDataRow will return an empty array.

To determine the IDs of all the data rows in a data recordset, use the DataRecordset.GetDataRowIDs method. Note that data row IDs do not necessarily always correspond to the logical position of the data rows in the data recordset.

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the GetShapesLinkedToDataRow method to determine the shape IDs of the shapes on the page linked to data in the data row with ID number 1 in the data recordset most recently added to the DataRecordsets collection of the current document. It prints the shape IDs in the Immediate window.

Before running this macro, use the DataRecordsets.Add method or another means to add at least one data recordset to the DataRecordsets collection, and make sure there is at least one shape on the active page linked to data in the data row with ID number 1 in the data recordset.

Public Sub GetShapesLinkedToDataRow_Example() 
 
    Dim vsoDataRecordset As Visio.DataRecordset 
    Dim intRecordsetCount As Integer 
    Dim alngShapeIDs() As Long 
    Dim lngDataRowID As Long 
    Dim intArrayCounter As Integer 
     
    intRecordsetCount = Visio.ActiveDocument.DataRecordsets.Count 
    Set vsoDataRecordset = Visio.ActiveDocument.DataRecordsets(intRecordsetCount) 
     
    lngDataRowID = 1 
     
    ActivePage.GetShapesLinkedToDataRow vsoDataRecordset.ID, lngDataRowID, alngShapeIDs 
     
    For intArrayCounter = LBound(alngShapeIDs) To UBound(alngShapeIDs) 
        Debug.Print alngShapeIDs(intArrayCounter) 
    Next 
     
End Sub

Community Additions

ADD
Show:
© 2014 Microsoft