Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Clariee Rossi   on Nov 20 In MS Office Category.

  
Question Answered By: Viheke Fischer   on Nov 20

Here is some simple code  to read from a text  file until it is empty. The
parsing of the information is simple, the record read is broken into three
fields of a ten characters.



Public Sub Read_Text()



Dim TextLine As String, Field1 As String, Field2 As String, Field3 As String



Open "C:\My Documents\Testfields.txt" For Input As #1



Do While Not EOF(1) ' Loop until end of file.



Line Input #1, TextLine ' Read line into variable.



Field1 = Trim(Mid(TextLine, 1, 10))

Field2 = Trim(Mid(TextLine, 11, 20))

Field3 = Trim(Mid(TextLine, 21, 30))



Loop



Close #1



End Sub

Share: 

 

This Question has 7 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Text File Parser Or get search suggestion and latest updates.


Tagged: