excel - How to remove a linebreak in a text file VBScript -
i have numerous csv files , don't import correctly excel, im asking there way remove line breaks @ end of strline using vbscript?
yes, can remove line breaks csvs. readline
automatically remove line breaks end of line:
set fso = createobject("scripting.filesystemobject") filename = "c:\path\to\your.csv" f1 = fso.opentextfile(filename) f2 = fso.opentextfile(filename & ".tmp", 2, true) until f1.atendofstream f2.write f1.readline loop f1.close f2.close
or read whole file , replace line breaks:
set fso = createobject("scripting.filesystemobject") filename = "c:\path\to\your.csv" text = fso.opentextfile(filename).readall fso.opentextfile(filename, 2).write replace(text, vbnewline, ",")
however, might addressing symptom rather cause. second ekkehard.horner's comment: better answer should provide more details input file , way import fails.
Comments
Post a Comment