Solution
You can read text from a Microsoft Word document using the Microsoft ActiveX API. See Figure 3. for an overall reference. The basic process is as follows:
- Open a reference to the Microsoft Word application using the LabVIEW Automation Open function.
- Access the Documents object, a property of the newly created Application object.
Figure 1: Opening the Applications and Documents objects
- Invoke the Open method, and specify the path to the document you wish to open.
- Access the Content property of the Document object. This is a Range object comprising the entirety of the opened document.
- Access the Text property of the Content object. This returns a string containing the text of the Word document.
Figure 2: Reading the text from the document
Figure 3: The full code for reading from the Word document