Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Reading From a text file

Posted on 2003-11-05
3
368 Views
Last Modified: 2012-05-04
This is a somewhat stupid question... How do I read from a text file?

I have a tab delimited text file and I need to read in line by line the file.

I can not directly import the file because I need to make modifications to the fields.

   - Marc
0
Comment
Question by:MarcGraff
  • 2
3 Comments
 
LVL 28

Accepted Solution

by:
AzraSound earned 250 total points
ID: 9690521
Dim strData As String

Open "C:\file.txt" For Input As #1
Do Until EOF(1)
    Line Input #1, strData

    'strData now contains the line of data - process as needed
Loop
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 9690527
Oh, don't forget a "Close #1" (minus the quotes) after the loop to close the file.
0
 
LVL 1

Author Comment

by:MarcGraff
ID: 9691473
Thanks!

   - Marc
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

828 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