Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading a Word doc file in Excel VBA

Status
Not open for further replies.

phudgens

Technical User
Jul 8, 2004
117
US
I'm using Excel 2007 VBA to try and read a MS Word doc file by using the following code to convert it to RTF:

Code:
Dim WordApp
Set WordApp = CreateObject("Word.Application")
WordApp.Documents.Open FileName
WordApp.ActiveDocument.SaveAs DocFile, wdFormatRTF
WordApp.Quit

I'm getting a "Variable not defined" during compilation for "wdFormatRTF" - everything else is working. Does anyone know what causes that, or any way to read a doc file in to text strings line by line?

Thanks,
Paul Hudgens
Denver
 


In the VB Editor, Tools > References and CHECK the box for Microsoft Word m.n Object Library where m.n is the highest release.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top