ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Import text onto form (https://www.excelbanter.com/excel-programming/376642-import-text-onto-form.html)

Marko Svaco

Import text onto form
 
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


WhytheQ

Import text onto form
 
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



On Nov 3, 12:50 pm, "Marko Svaco" wrote:
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



Marko Svaco

Import text onto form
 
Thanks for the quick reply!!
I think that it will work great!
Thanks!

Marko Svaco,
Croatia



All times are GMT +1. The time now is 05:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com