Solved

how to i remove a special character from csv file with VB?

Posted on 2010-09-24
1
655 Views
Last Modified: 2012-05-10
I have one special character added to the end of my csv files. I am attaching a screen shot that displays how it shows in Notepad++ and Notepad. notepad is on top. notepad++ on bottom.  How would i remove this with a VB script? notepad screenshot
0
Comment
Question by:rarid122481
1 Comment
 
LVL 2

Accepted Solution

by:
jasgiv1122 earned 500 total points
ID: 33755000
This is assuming you don't have a blank line of text at the end.  (This deletes the last line of text)
Const ForReading = 1

Const ForWriting = 2



Set objFSo = CreateObject("Scripting.FileSystemObject")

Set objFile = objFSO.OpenTextFile("c:\scripts\test.txt", ForReading)



strContents = objFile.ReadAll

objFile.Close



arrLines = Split(strContents, vbCrLf)



Set objFile = objFSO.OpenTextFile("c:\scripts\test.txt", ForWriting)



For i = 0 to UBound(arrLines) - 1

    objFile.WriteLine arrLines(i)

Next



objFile.Close

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is an addendum to the following article: Acitve Directory based Outlook Signature (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_24950055.html) The script is fine, and works in normal client-server domains…
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now