Shape.GetCustomPropertiesLinkedToData method (Visio)

Gets the IDs of the shape-data-item (custom property) rows in the Shape Data section of the shape's ShapeSheet spreadsheet linked to the specified data recordset.


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


expression. GetCustomPropertiesLinkedToData( _DataRecordsetID_ , _CustomPropertyIndices()_ )

expression An expression that returns a Shape object.


Name Required/Optional Data type Description
DataRecordsetID Required Long The ID of the data recordset that contains the data the shape is linked to.
CustomPropertyIndices() Required Long Out parameter. An empty, dimensionless array that the method fills with the row IDs of the shape-data-item (custom property) rows in the shape's ShapeSheet that are linked to data columns in the data recordset.

Return value



Knowing how shapes are linked to data can help prevent conflicts and broken links when you refresh the data in one or more data recordsets.


In some previous versions of Visio, shape data were called custom properties.


The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the GetCustomPropertiesLinkedToData method to get the IDs of the shape-data-item (custom property) rows linked to a data column in a data recordset.

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 data in the data recordset most recently added to the collection, and then tests to make sure the linking is successful. If it is, it gets the row IDs of all ShapeSheet rows linked to data prints the IDs of the rows in the Immediate window.

Public Sub GetCustomPropertiesLinkedToData_Example() 
    Dim vsoDataRecordset As Visio.DataRecordset 
    Dim vsoShape As Visio.Shape 
    Dim intCount As Integer 
    Dim boolIsLinked As Boolean 
    Dim alngIndices() As Long 
    Dim intArrayIndex as Integer 
    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 
    boolIsLinked = vsoShape.IsCustomPropertyLinked(vsoDataRecordset.ID, 1) 
    If boolIsLinked Then 
        vsoShape.GetCustomPropertiesLinkedToData vsoDataRecordset.ID, alngIndices 
        For intArrayIndex = LBound(alngIndices) To UBound(alngIndices) 
             Debug.Print alngIndices(intArrayIndex) 
        Debug.Print "Not linked." 
    End If 
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.