Upravit

Sdílet prostřednictvím


Selection.BreakLinkToData method (Visio)

Breaks links between all shapes in the selection and data rows in the specified data recordset.

Note

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

Syntax

expression. BreakLinkToData( _DataRecordsetID_ )

expression An expression that returns a Selection object.

Parameters

Name Required/Optional Data type Description
DataRecordsetID Required Long The ID of the data recordset containing the data rows with which to break links.

Return value

Nothing

Remarks

If Microsoft Visio cannot break the link between a shape in the selection and the data row, or if the link does not exist, Visio skips that shape and goes on to the next shape in the selection. After you run the method, to determine if anyshapes in the selection are still linked to a data row, call the Shape.GetLinkedDataRow method on each shape in the selection. If the GetLinkedDataRow method fails for any shape, it indicates that the shape either no longer is linked to the data row, or never was linked to the data row.

Note that breaking links between shapes and data does not remove shape data (called custom properties in some previous versions of Visio) from shapes, nor does it remove data graphics associated with shapes.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the BreakLinkToData method to break all links between the shapes in a selection and data rows in a data recordset.

Before running this macro, place several shapes on the page, add at least one data recordset to the DataRecordsets collection of the document, and use any linking method to link several shapes to one or more data rows in the data recordset you most recently added to the collection.

Public Sub BreakLinkToData_Example() 
 
    Dim vsoDataRecordset As Visio.DataRecordset 
    Dim vsoSelection As Visio.Selection 
    Dim intCount As Integer 
        
    intCount = Visio.ActiveDocument.DataRecordsets.Count 
    Set vsoDataRecordset = Visio.ActiveDocument.DataRecordsets(intCount) 
     
    ActiveWindow.DeselectAll 
    ActiveWindow.SelectAll 
     
    Set vsoSelection = ActiveWindow.Selection 
    Call vsoSelection.BreakLinkToData(vsoDataRecordset.ID) 
     
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.