csv - Remove commas from end of line in text file with VBA -
i have written vba code output comma seperated data elements text file imported seperated application. however, stuck how remove end of line commas generated in text file.
following example of data:
scenario,capital,afe capital array,drilling capex 80/20,replace, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, capital array,facilities tangible,replace, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,250,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, capital array,recompletion 80/20,replace, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
the best solution not add trailing comma in first place. that, need modify code have not shown us.
alternatively, if csv creation code black box not want touch, can manually remove last character in string:
mystring = "a,b,c,d," if right(mystring, 1) = "," mystring = left(mystring, len(mystring) - 1) end if ' mystring "a,b,c,d"
Comments
Post a Comment