Solved

vb readline remove comma's

Posted on 2013-11-01
3
365 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
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
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…

749 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