Düzenle

Aracılığıyla paylaş


Shape.GetCustomPropertyLinkedColumn method (Visio)

Gets the name of the data column linked to the shape data (custom property) row in the shape's ShapeSheet spreadsheet specified by the custom property index.

Note

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

Syntax

expression. GetCustomPropertyLinkedColumn( _DataRecordsetID_ , _CustomPropertyIndex_ )

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 data column linked to the shape's custom property.
CustomPropertyIndex Required Long The index of the shape data item (custom property) linked to the data column in the data recordset.

Return value

String

Remarks

If the method fails, call the Shape.IsCustomPropertyLinked method to make sure that the shape data item (custom property row) was actually linked to the data column.

Note

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

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the GetCustomPropertyLinkedColumn method to get the name of the data recordset column linked to a particular shape data item.

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 prints the name of the data recordset column linked to the specified shape data item (custom property) in the Immediate window.

Public Sub GetCustomPropertyLinkedColumn_Example() 
 
    Dim vsoDataRecordset As Visio.DataRecordset 
    Dim vsoShape As Visio.Shape 
    Dim intCount As Integer 
    Dim boolIsLinked As Boolean 
    Dim lngIndex As Long 
    Dim strColumnName As String 
         
    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 
     
        strColumnName = vsoShape.GetCustomPropertyLinkedColumn(vsoDataRecordset.ID, 1) 
        Debug.Print "Linked column name is", strColumnName 
     
    Else 
     
        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.