DataRecordset.Delete Method (Visio)

Office 2013 and later
GitHub-Mark-64px

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

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

Note Note

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

expression .Delete

expression A variable that represents a DataRecordset object.

Return Value

Nothing

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

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.

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
Show: