Thank you Garry. I will give this a shot.
In a standard module...
Option Explicit
Sub CSVtoText()
Dim vDataIn, n&, j&, sDataOut$
vDataIn = ActiveSheet.UsedRange
For n = LBound(vDataIn) To UBound(vDataIn)
For j = LBound(vDataIn) To UBound(vDataIn, 2)
sDataOut = sDataOut & vDataIn(n, j)
If Not j = UBound(vDataIn, 2) Then sDataOut = sDataOut & " "
Next 'j
If Not n = UBound(vDataIn) Then sDataOut = sDataOut & vbCrLf
Next 'n
WriteTextFileContents sDataOut, "C:\test_CSVtoText.txt"
End Sub
Sub WriteTextFileContents(TextOut$, Filename$, _
Optional AppendMode As Boolean = False)
' Reusable procedure that Writes/Overwrites or Appends
' large amounts of data to a Text file in one single step.
' **Does not create a blank line at the end of the file**
Dim iNum As Integer
On Error GoTo ErrHandler
iNum = FreeFile()
If AppendMode Then
Open Filename For Append As #iNum: Print #iNum, vbCrLf & TextOut;
Else
Open Filename For Output As #iNum: Print #iNum, TextOut;
End If
ErrHandler:
Close #iNum: If Err Then Err.Raise Err.Number, , Err.Description
End Sub 'WriteTextFileContents()
--
Garry
Free usenet access at
http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com