Solved

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

Posted on 2010-09-24
1
654 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction During my participation as a VBScript contributor at Experts Exchange, one of the most common questions I come across is this: "I have a script that runs against only one computer. How can I make it run against a list of computers in …
This script will sweep a range of IP addresses (class c only, 255.255.255.0) and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 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

20 Experts available now in Live!

Get 1:1 Help Now