ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I save excel text without formatting? (https://www.excelbanter.com/excel-programming/382052-how-do-i-save-excel-text-without-formatting.html)

BruceMcG

How do I save excel text without formatting?
 
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?

Carl Hartness[_2_]

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?




All times are GMT +1. The time now is 09:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com