Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Comma Delimited-need comma at beginnng & end
How do you do a comma delimited file that has a comma in the first cell and
the last cell? Whenever I put a comma in the first and last column, it puts quotation marks around the comma. -- Tattoo |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Comma Delimited-need comma at beginnng & end
Here is code that I have used before (slighly modified) that a I have posted
a number of times before. It always gives great results. Modify the 2nd and 3rd lines as required. Sub WriteCSV() Const MyPath = "C:\temp\" Const WriteFileName = "text.csv" Const Delimiter = "," Const ForReading = 1, ForWriting = 2, ForAppending = 3 Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0 Set fswrite = CreateObject("Scripting.FileSystemObject") 'open files WritePathName = MyPath + WriteFileName fswrite.CreateTextFile WritePathName Set fwrite = fswrite.GetFile(WritePathName) Set tswrite = fwrite.OpenAsTextStream(ForWriting, TristateUseDefault) LastRow = Cells(Rows.Count, "A").End(xlUp).Row For RowCount = 1 To LastRow LastCol = Cells(RowCount, Columns.Count).End(xlToLeft).Column For ColCount = 1 To LastCol If ColCount = 1 Then OutputLine = "," & Cells(RowCount, ColCount) Else OutputLine = OutputLine & Delimiter & Cells(RowCount, ColCount) End If Next ColCount OutputLine = OutputLine & "," tswrite.writeline OutputLine Next RowCount tswrite.Close Exit Sub End Sub "Tattoo" wrote: How do you do a comma delimited file that has a comma in the first cell and the last cell? Whenever I put a comma in the first and last column, it puts quotation marks around the comma. -- Tattoo |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Comma Delimited-need comma at beginnng & end
How about putting something else in that first column?
I like to use a formula that makes the cell look blank: ="" Tattoo wrote: How do you do a comma delimited file that has a comma in the first cell and the last cell? Whenever I put a comma in the first and last column, it puts quotation marks around the comma. -- Tattoo -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Comma Delimited Numbers | Excel Discussion (Misc queries) | |||
Creating CSV Comma Delimited File | Excel Discussion (Misc queries) | |||
Importing Comma delimited file | Excel Discussion (Misc queries) | |||
Comma delimited question | Excel Discussion (Misc queries) | |||
HELP - I need to change space delimited to comma? | Excel Discussion (Misc queries) |