Results 1 to 4 of 4

Thread: .Input ( Read Contentsof Text File - line by Line )

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2001
    Location
    Australia
    Posts
    10

    Question

    I'm trying to import Data from a text file, which includes the following,

    Vessel Name
    000115600
    000025600
    000000000
    000089000
    000019000
    000000000
    6670.43

    The above file is updated every five minutes and I wish to retreive this data in
    order to perform calc's and then display a completion time for a process on the
    User Form.

    code:-----------------------------------------------------------------------------
    ---
    Open "YourFile.txt" For Input As #1
    While Not EOF(1)
    Input #1, YourVariable
    List1.Additem YourVariable
    Wend
    Close #1
    --------------------------------------------------------------------------------

    Instead of adding to a list as in the above example, I want to process it Line by
    Line ( How do I achieve this using .Input ).

    Help

    Tony Dow

  2. #2
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Use "Line Input #1" instead of Input #1

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2001
    Location
    Australia
    Posts
    10

    Use "Line Input #1" instead of Input #1

    Sorry - Still can't get it to work - must be doing something wrong , how should it be written for each line ?
    Tony Dow

  4. #4
    Matthew Gates
    Guest
    This code works for me:


    Code:
    Dim YourVariable As String
    Open "YourFile.txt" For Input As #1 
    Do While Not EOF(1) 
    Line Input #1, YourVariable 
    List1.Additem YourVariable 
    Loop 
    Close #1

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