Solved

vb readline remove comma's

Posted on 2013-11-01
3
371 Views
Last Modified: 2013-11-01
folks

in my vb macro I am using the readline method that copies an entire row/line from a text file, how can I remove comma's from being carred into the line? the problem is that some of my rows contain comma's and seeing that I an writing the readline value into a text file with additional data's delimited with a comma from eachother which causes confusion

all help will do
0
Comment
Question by:rutgermons
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 500 total points
ID: 39618048
Something like

var = replace(var,",","")
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 39618058
depending on the purpose of the commas, you may want to use the above but replace with tabs instead of empty-string:

var = replace(var,",",vbTab)

Or you may want to break the pieces up into parts and apply them in different ways as individual values:

Dim items() As String
Dim itemCntr As Integer

items = Split(inputlineText, ",")
For itemCntr=0 to UBound(items)
  Debug.Print items(itemCntr)' or other code to do something with the item
Next
0
 

Author Comment

by:rutgermons
ID: 39618059
exactly what I needed

solution is : strData = Replace(objLogFile.ReadLine, ",", "")
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

707 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