View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Carl Hartness[_2_] Carl Hartness[_2_] is offline
external usenet poster
 
Posts: 63
Default How do I save excel text without formatting?

Sub DumpToTxtFile()
' dump Ax:Fx to text file, separated by my delimiter
Dim fName$, dataRow As Integer, x As Integer, s As String
fName$ = "myTxtFile.txt"
Close #2 ' be sure is not already open
On Error GoTo notOpened
Open fName$ For Output As #2
On Error Resume Next

dataRow = 1
s = Cells(dataRow, 1)
For x = 2 To 6
s = s & ", " & Cells(dataRow, x)
Next x
Print #2, s$
notOpened:
Close #2
On Error GoTo 0 ' cancel error handling
End Sub

On Jan 26, 8:55 pm, BruceMcG
wrote:
I want to generate a series of small text files, each from the contents of
six cells in one row. I do not want "assistance" from Excel adding quotes or
delimiters. Pasting the contents into Notepad works but it is labor
intensive. How can I do this?