Shape.BreakLinkToData Method (Visio)

Breaks the link between the shape and the data row to which it is linked in the specified data recordset.

Note

This Visio object or member is available only to licensed users of Microsoft Visio Professional 2010 or Visio Premium 2010.

Version Information

Version Added: Visio 2007

Syntax

expression .BreakLinkToData(DataRecordsetID)

expression An expression that returns a Shape object.

Parameters

Name

Required/Optional

Data Type

Description

DataRecordsetID

Required

Long

The ID of the data recordset containing the data row the shape is linked to.

Return Value

Nothing

Remarks

Breaking the link between an shape and a data row does not remove shape data (called custom properties in some previous versions of Visio) from the shape, nor does it remove any data graphics associated with the shape.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the BreakLinkToData method to break the link between a shape and a data row in a data recordset.

Before running this macro, place a shape on the page, add at least one data recordset to the DataRecordsets collection of the document, and use any linking method to link the shape to a data row in the data recordset you most recently added to the collection. Alternatively, you could link the shape to a data row by dragging the row from the External Data window onto the shape in the Visio user interface. Then select the linked shape.

Public Sub BreakLinkToData_Example() 
 
    Dim vsoDataRecordset As Visio.DataRecordset 
    Dim vsoShape As Visio.Shape 
    Dim intCount As Integer 
         
    intCount = Visio.ActiveDocument.DataRecordsets.Count 
    Set vsoDataRecordset = Visio.ActiveDocument.DataRecordsets(intCount) 
     
    Set vsoShape = ActiveWindow.Selection.PrimaryItem 
    vsoShape.BreakLinkToData (vsoDataRecordset.ID) 
    
End Sub