Results 1 to 3 of 3

Thread: ASCII File input# problem w/ commas

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2001
    Posts
    158

    Unhappy ASCII File input# problem w/ commas

    I'm using Excel VBA to read some big ASCII/Text files.

    I've run into a problem and finally figured out that when I'm INPUTing lines in from the text file, lines with commas in them are broken up.

    example line:

    "asdfa 23 asdf asdf,xcvzxc"

    gets read as two separate lines and the comma disappears:

    "asdfa 23 asdf asdf"
    "xcvzxc"


    I'm reading the lines into an array like this:
    Code:
    Dim MyArray() as String
    
    X = 0
    Do While not EOF(1)
    X = X + 1
    ReDim Preserve MyArray(X)
    Input #1, MyArray(X)
    Loop

    Uggg... Help me.

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    Try Line Input instead.,...

    TG
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Dec 2001
    Posts
    158
    Wow... I had no idea. For "Input", "Line Input" doesn't show up as a related topic in the help file.

    Poop - egg on my face.


    Thanks man

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width