Results 1 to 3 of 3

Thread: Reading Word Documents

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 1999
    Posts
    41
    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.

  2. #2
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    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.
    Iain, thats with an i by the way!

  3. #3
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633

    Try this one!

    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
    Chemically Formulated As:
    Dr. Nitro

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width