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

Shape.GetCustomPropertiesLinkedToData Method (Visio)

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

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.

Note 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.


NameRequired/OptionalData TypeDescription
DataRecordsetIDRequiredLongThe ID of the data recordset that contains the data the shape is linked to.
CustomPropertyIndices()RequiredLongOut 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.

Note 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
© 2018 Microsoft