I am working with an example which saves a recordset to a CSV file, but the resulting CSV file has quotes, all I need in commas.
I can't seem to get the syntax correct for commas only.
Code:
Code:Public Function RecordsetToCSV(rsData As ADODB.Recordset, _ Optional ShowColumnNames As Boolean = True, _ Optional NULLStr As String = "") As String Dim K As Long, RetStr As String If ShowColumnNames Then For K = 0 To rsData.Fields.Count - 1 RetStr = RetStr & ",""" & rsData.Fields(K).Name & """" Next K RetStr = Mid(RetStr, 2) & vbNewLine End If RetStr = RetStr & """" & rsData.GetString(adClipString, -1, """,""", """" & vbNewLine & """", NULLStr) RetStr = Left(RetStr, Len(RetStr) - 3) RecordsetToCSV = RetStr End Function
Any advice appreciated.




Reply With Quote
