Shape.BreakLinkToData Method

Visio Automation Reference

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

ms427223.vs_note(en-us,office.12).gif  Note
This Visio object or member is available only to licensed users of Microsoft Office Visio Professional 2007.

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

Visual Basic for Applications
  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

See Also