Import text onto form

  • Thread starter Thread starter Marko Svaco
  • Start date Start date
M

Marko Svaco

Hi all!

I have a text file(notepad) for example in c:\
This text file has 20 rows or more.
How can I import the data in each row into a VBA form.
Or just how can i reference the data in that text file so that i can
make an array of strings which would get their values(text).
Thanks!!

Marko Svaco,
Croatia
 
I thought you might have to resort to an old-fashioned style method and
some code I found of Chip Pearsons seems to back that up:

Sub ReadTheTextFile()

Dim S As String
Open "H:\TextFileName.txt" For Input As #1 ' change filename
Do Until EOF(1)
Line Input #1, S
Debug.Print S
Loop
Close #1

End Sub

.....the above writes each line of the text file to your immediate
window but maybe you can adapt, by changing the line "Debug.Print S" to
fit your needs

Rgds
J
 
Thanks for the quick reply!!
I think that it will work great!
Thanks!

Marko Svaco,
Croatia
 
Back
Top