Groups

    Calling all VBScript experts !

    I have two csv files

    The first one is that which I want to read information from
    The second is that which I want to paste the information into the first csv file in a specific place.

    What I am trying to do is convert the layout of one csv into a different layout

    Can anyone please help or at least start me off!

    Thanks guys

    8 Comments

    CSV, comma seperated values?

    I'm not a VB expert but I sould suspect you could use something like string.split(), for each line of the file?

    Check the API.

    you using VB.net ?

    Need more info: Is this a one off or something you need to be repeatable? Any specific reason why VBScript? Is it .NET or old style VBScript?

    Original Poster

    Thanks guys (and gals?)

    I need to read from one csv and write to another from the first one. It needs to be done through excel.

    It should be quite simple, simple if and while loops.

    is this the kind of thing you are looking for?

    Well for the read anyway, I dont like VB but found this with some of my old work.

    Private Sub cmdReadFile_Click()
    'open and read from the file

    Dim person As String, telno As String
    Dim fnum As Integer

    Cls 'Clears the form
    fnum = FreeFile
    Open "n:\Visual Basic\VB Exerc HNU\chapter 6\readtest.txt" For Input As #fnum 'open file for reading
    Do While Not EOF(fnum)
    Input #fnum, person 'read name from file
    Input #fnum, telno 'read telephone numbe from file
    Print person, telno 'Prints the name and telephone number on the form
    Loop 'keep going round the loop until
    Close #fnum 'End Of File is reached

    End Sub

    Have a read of the Wikipedia CSV page: en.wikipedia.org/wik…ort there are links to info on manipulating CSV files in a number of languages, including VBScript.

    Original Poster

    thanks a lot guys!
    I will look at the wiki site
    LadyMadonna: Not sure ... will study it in just a bit and let yo uknow

    you guys are awesome!

    Original Poster

    Thanks to all for their help

    i managed to get this piece of work doen today with the help of various sites, and of course your help as above. Mission completed ...

    thanks again.
    Post a comment
    Avatar
    @
      Text
      Top Discussions
      1. Potential upcoming Argos glitch or buggy app?109
      2. Xbox One - Buying from Other Regions *WITHOUT* A VPN (Virtual Private Netwo…1851337
      3. Vegan (Non-Dairy) Ben & Jerrys now launched in UK!1827
      4. Apples new update610

      See more discussions