Share via


DataRecordset.Delete Method

Visio Automation Reference

Deletes the DataRecordset object from the DataRecordsets collection of the document. .

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

expression   A variable that represents a DataRecordset object.

Return Value
Nothing

Remarks

If the DataRecordset object to be deleted is associated with a DataConnection object, and if that DataConnection object is not associated with any other DataRecordset objects, Microsoft Office Visio also deletes the DataConnection object.

Note that deleting a DataRecordset object does not delete the shapes that had been linked to data in that data recordset, nor does delete any existing shape data in those shapes that was created when the shapes were linked to data.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Delete method to delete a DataRecordset from the DataRecordsets collection of the current document. It gets the count of all data recordsets associated with the current document and deletes the one most recently added.

Visual Basic for Applications
  Public Sub Delete_Example()
Dim vsoDataRecordset As Visio.DataRecordset
Dim intCount As Integer

intCount = ThisDocument.DataRecordsets.Count
Set vsoDataRecordset = ThisDocument.DataRecordsets(intCount)
vsoDataRecordset.Delete

End Sub

See Also