Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Reading From Word Document

Posted on 1999-07-20
Medium Priority
Last Modified: 2010-05-02
How can I open and read a Microsoft Word Document?
Question by:mh149
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

lbk earned 50 total points
ID: 1526205
You can either use OLE (Reference Office, word object library):

etc etc

or you can use VBA, but then you would have to initiate execution in word (There is ways around it, but complicated)

More info = more points


Expert Comment

ID: 1526206
use automation.  Put a reference in to Work Type Library.  Then you can do declare a variable of Word.Application.  Then there is all sorts of properties that you can look through to do whatever you want with the document.  You can use YourVariable.Range.FormattedText and this will return all of the text in the document.  Before you do this you will have to do YourVariable.Open blahfilename


Expert Comment

ID: 1526207
In your class :

Private wd As Word.Application     ' Handle on Word application

' Create a Word instance
If wd Is Nothing Then
    Set wd = CreateObject("word.application")
    If Not wd Is Nothing Then
        wd.Visible = False ' or True
        wd.DisplayAlerts = wdAlertsNone ' or 1
        '- Word error ?
    End If
End If

and to close it :

If Not wd Is Nothing Then
   Call wd.Quit(wdDoNotSaveChanges)
   Set wd = Nothing
End If

In the Project -> References, add a ref. to Microssoft Word 8.0 Object Library, so you can access to the constants, aso and define the wd var of Word.Application type (Early binding) instead of the more generic & less efficient Object type (Late binding)

Hope it helps

CU around


Author Comment

ID: 1526208
lbk - that amount of info is not worth much more than a comment...
would have given it to ESI has he proposed the answer

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question