Solved

Reading From a text file

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now