A recordset object in ADO library has Save method for saving the data directly into a file (XML/BInary) however if one needs to export all the data into a delimeted file then GetString method of the recordset will be very useful.

Here is a function that can be used to export an existing recordset to a delimeted file
VB Code:
  1. 'Function: WriteRecordsetToFile
  2. 'Input :
  3. '   rsExport -- The recordset that needs to be exported
  4. '   fileName -- Name of the file to which the recordset data will be saved
  5. '   cDelimeter -- The delimeter that will be used to separate columns
  6. 'Output
  7. '   Returns True if the process was successfull
  8. '   Returns False if the process failed
  9. Public Function writeRecordsetToFile(ByVal rsExport As ADODB.Recordset, _
  10.         fileName As String, cDelimeter As String) As Boolean
  11.     'create filesystem and Text stream objects
  12.     Dim currentFileSystem As FileSystemObject
  13.     Dim exportStream As TextStream
  14.     Dim tx As New ADODB.Command
  15.    
  16.     On Error GoTo exportError
  17.    
  18.     Set currentFileSystem = New FileSystemObject
  19.     'create the file
  20.     exportStream = currentFileSystem.CreateTextFile(fileName, True)
  21.     'get all the data from the recordset and save it in the file
  22.     exportStream.Write (rsExport.GetString(adClipString, , cDelimeter, vbCrLf))
  23.     'close the stream
  24.     exportStream.Close
  25.    
  26.     'release memory
  27.     Set exportStream = Nothing
  28.     Set currentFileSystem = Nothing
  29.     writeRecordsetToFile = True
  30.     Exit Function
  31.    
  32.     'error handler
  33. exportError:
  34.     '//TODO: write extra error handling code here
  35.     'there was an error while exporting
  36.     'release the memory before returning to calling function
  37.     Set exportStream = Nothing
  38.     Set currentFileSystem = Nothing
  39.     writeRecordsetToFile = False
  40. End Function

This function will return true if the export operation was successfull or else it will return false. We use FileSystemObject to create a TextStream and then save all the data to that stream. Here is how we can call this function
VB Code:
  1. If writeRecordsetToFile(myRecordset, "C:\myExportedFile.csv", ",") Then
  2.         MsgBox "Export was successfull"
  3.     Else
  4.         MsgBox "Export Failed"
  5.     End If
To execute this function you would need to have a Reference added to Microsoft Scripting Runtime.