Solved

Reading From a text file

Posted on 2003-11-05
3
367 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

776 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