Hi all,
I try to read file from file..
i put the file at drive D:\test.txt
Please help me..

Thanks.
Best Regards

Recommended Answers

All 3 Replies

There are many way to accomplish this.
See if this help :

' Get a free file number
nFileNum = FreeFile

' Open a text file for input. inputbox returns the path to read the file
Open "D:\test.txt" For Input As nFileNum
lLineCount = 1
' Read the contents of the file
Do While Not EOF(nFileNum)
   Line Input #nFileNum, sNextLine
   'do something with it
   'add line numbers to it, in this case!
   sNextLine = sNextLine & vbCrLf
   sText = sText & sNextLine

Loop
Text1.Text = sText
' Close the file
Close nFileNum
commented: Really Quick Solution.. thx jx +3
commented: This a good stuf :) +2

Thank you very much for your quick help..
and also solved this thread.

Thank you.

You're welcome friend..
Happy coding.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.