Change number format

Posted on 2011-04-30
Last Modified: 2012-06-27
I am running a vb script that saves to a csv file. I have a number that is coming over with comas included so it is causing problems when I open it  up in excel. Can anyone tell me how to format this so that it still works the same but the output of fsize does not have any commas?

thanks for your help!

If InStr(strText,"Size:         ")>0 Then
            fsize=Replace(strText,"Size:         ","")
            fsize=Replace(fsize," bytes","")
           ' WScript.Echo "File size " & fsizedbl
            outputfile.WriteLine strcomputer & "," & folder & "," &  fsize
            Exit Do
        End If

Open in new window

Question by:CCG3
    LVL 5

    Accepted Solution

    outputfile.WriteLine strcomputer & "," & folder & "," &  Replace(fsize, ",", ".")  ' ?

    Open in new window


    Author Comment

    I changed it to this.. but now it looks like it works fine for me.
    outputfile.WriteLine strcomputer & "," & folder & "," &  Replace(fsize, ",", "")  '

    Open in new window

    LVL 5

    Expert Comment

    :-) Sorry, I've thought that comma is decimal separator. In my place (Ukraine) decimal separator is usually comma, but some software uses a dot instead. But if you have commas as thousands separator, then there is really no need to replace them with dots.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    I met Paul Devereux (@pdevereux) today when I responded to his tweet asking “Anybody know how to automate adding files from disk to a folder in #outlook  ?”.  I replied back and told Paul that using automation, in this case scripting, to add files t…
    This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    745 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

    13 Experts available now in Live!

    Get 1:1 Help Now