Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I've got a CSV file to which I need to add a header line. I wrote a
little VB Script to do this. Once I ran it the size of the file literally doubled. The header line is there now, however. When I open the file in Excel, however, all the text in each line opens in one cell. It's quite annoying. Has anyone seen this before? Okay, maybe not the exact problem, but maybe where Excel won't open a CSV correctly? I'm thinking there must be some odd character or something in it that causes this, but the file "looks" normal. Thanks for any suggestions, Jennifer Just in case anyone is interested, this is the script does: Dim DtlHdrDim FilePath Dim DtlName Dim FSO, Fil, TempFile, TempName Dim sLine Const ForReading = 1, ForWriting = 2, ForAppending = 8 FilePath = "\\hqimpact\mktdata\Extract\" DtlName = FilePath & "SalesDtl.csv" TempName = FilePath & "Temp.csv" Set FSO = CreateObject("scripting.filesystemobject") DtlHdr = "parSalesHdrID,parSalesDetailID,Before,Quantity,Af ter,Promo,PromoBefore" & _ "ItemPrice,PromoAfter,POSItem,UnitNumber,Deple ted" Set Fil = FSO.OpenTextFile(DtlName, ForReading, False) sLine = Fil.ReadLine If sLine < DtlHdr Then Set TempFile = FSO.CreateTextFile(TempName,ForWriting, True) TempFile.WriteLine DtlHdr Do Until Fil.AtEndOfStream sLine = Fil.ReadLine TempFile.WriteLine sLine Loop Fil.Close FSO.CopyFile TempName, DtlName, True TempFile.Close FSO.DeleteFile TempName End If Set Fil = Nothing Set FSO = Nothing |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel Outlook Attachments opening after several errors everytime | Setting up and Configuration of Excel | |||
Weird File Open/Save As Behavior | Excel Discussion (Misc queries) | |||
Excel startup switches | Excel Discussion (Misc queries) | |||
Why Excel file doesn't open by double click. | Excel Discussion (Misc queries) | |||
How Do I open an excel file without Excel Viewer support | Excel Discussion (Misc queries) |