Can somebody help me with opening and reading a Word document in VB5?
I opened a file for input. And as I go line by line it shows unreadable information.
Thank you.
Printable View
Can somebody help me with opening and reading a Word document in VB5?
I opened a file for input. And as I go line by line it shows unreadable information.
Thank you.
That is because Word stores its documents in its own format. The only way to see what is in a word document is to load it into word. You could embed a word object in your application, and load the file into that.
If you want to load it uo into a text box then you will have to save it as plain text.
If you use a richtext box, you could save the document as a ".rtf" file, and you could load that into the rich text box.
Code:Sub pWord()
Dim xlApp As Object
Set xlApp = CreateObject("Word.Application")
xlApp.Visible = True
DoEvents 'Pause until everything previously has been process
xlApp.Documents.Open FileName:="C:\Your Document.doc", PasswordDocument:="Testing"
Set xlApp = Nothing
End Sub