Saving strings as csv files in VB6

Discussion in 'Software' started by ceal21c, May 25, 2006.

  1. ceal21c

    ceal21c Private E-2

    Hey Guys,

    How can I save a string (or array) as a comma seperated value? I can read csv files and store the data as a string or an array but when I try to save the data after I have edited it, it looses the csv format and is saved as one long line.

    This is the code I use to read the data:
    Open "c:\XFER\Users\users.csv" For Binary As #1
    strUserList = Input(LOF(1), #1)
    Close

    And this is the code I use to write data:
    Open "c:\XFER\Users\users.csv" For Output As #1
    Write #1, strUpdatedUserList

    Where am I going wrong?
     
  2. ceal21c

    ceal21c Private E-2

    Found that using Print #1, strUpdatedUserList instead of Write #1, strUpdatedUserList works GREAT!
     
  3. Kodo

    Kodo SNATCHSQUATCH

    use the Scripting.Filesystem Object for your file I/O operations in VB6. it will save you much time. Yes.. I said scripting.. it will still work in VB6..
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds