Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Automated " delimiter adder?
I found the following in my script archives. I thought it was for adding a "
delimiter to a text file but I cannot seem to remember how to make this work. I thought I would ask some of you to help me out. Thank you in advance. Mr BT Public Sub OutputQuotedCSV() Const QSTR As String = """" Dim myRecord As Range Dim myField As Range Dim nFileNum As Long Dim sOut As String nFileNum = FreeFile Open "File1.txt" For Output As #nFileNum For Each myRecord In Range("A1:A" & _ Range("A" & Rows.Count).End(xlUp).Row) With myRecord For Each myField In Range(.Cells(1), _ Cells(.Row, 256).End(xlToLeft)) sOut = sOut & "," & QSTR & _ Replace(myField.Text, QSTR, QSTR & QSTR) & QSTR Next myField Print #nFileNum, Mid(sOut, 2) sOut = Empty End With Next myRecord Close #nFileNum End Sub |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Automated " delimiter adder?
See
http://www.mvps.org/dmcritchie/excel/getstarted.htm In article <siE6i.231586$6m4.18530@pd7urf1no, "Mr BT" wrote: I found the following in my script archives. I thought it was for adding a " delimiter to a text file but I cannot seem to remember how to make this work. I thought I would ask some of you to help me out. Thank you in advance. Mr BT Public Sub OutputQuotedCSV() Const QSTR As String = """" Dim myRecord As Range Dim myField As Range Dim nFileNum As Long Dim sOut As String nFileNum = FreeFile Open "File1.txt" For Output As #nFileNum For Each myRecord In Range("A1:A" & _ Range("A" & Rows.Count).End(xlUp).Row) With myRecord For Each myField In Range(.Cells(1), _ Cells(.Row, 256).End(xlToLeft)) sOut = sOut & "," & QSTR & _ Replace(myField.Text, QSTR, QSTR & QSTR) & QSTR Next myField Print #nFileNum, Mid(sOut, 2) sOut = Empty End With Next myRecord Close #nFileNum End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to use more than one "other" delimiter in excel | Excel Discussion (Misc queries) | |||
"carriage return" as the delimiter? | Excel Discussion (Misc queries) | |||
Comma delimiter | Excel Worksheet Functions | |||
HELP on "left","right","find","len","substitute" functions | Excel Discussion (Misc queries) | |||
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next | New Users to Excel |