John Nurick wrote:
As Jezebel says, getting text from text files and Word documents are
totally different processes.
If it's a text file, there's a readymade procedure here
http://www.j.nurick.dial.pipex.com/Code/VBA/FileContents.htm which reads
the contents of a text file into a VBA variable.
On 23 Aug 2006 12:19:05 -0700, (e-mail address removed) wrote:
I'm very new at this and would like some help. I'm using Word 2003, VB
6.3. I'm trying to learn how to get text from a file (.txt or.doc) on
the C-Drive and put it into a TextBox. Can anyone help?
If this is basic, keep in mind I'm at the very beginning and slowly
learning vba.
Thanks
Joe
--
John Nurick [Microsoft Access MVP]
Please respond in the newgroup and not by email.
Thanks for the link. I tried and tried to use it but I couldn't get it
to work,However........
I did manageto get a MsgBox to appear...which I think I'm close
(Wishful thinking,lol)
Here is the code I used;
Private Sub CopyFile_Click()
ChangeFileOpenDirectory "C:\"
Dim TextLine
Open "MYTEST1.txt" For Input As #1 ' Open file.
Do While Not EOF(1) ' Loop until end of file.
Line Input #1, TextLine ' Read line into variable.
Debug.Print TextLine ' Print to the Immediate window.
MsgBox (TextLine)
Loop
Close #1 ' Close file.
End Sub
If I could only get it into the actual TextBox ("TextBox1"),
Do you have any more sugestions?
Joe