Getting text from a Word Document

R

rc51wv

I need to Access a word document, which will be strLocation, and take the
first like of text and put it into a variable, which is strTitle.

How do I achieve this?

-TIA
 
J

John Nurick

If the title is the first paragraph of the document, it's easy. Just set
a reference to the Microsoft Word x.xx Object Library and then do
something like

Dim oDoc as Word.Document

Set oDoc = GetObject(strLocation)
strTitle = oDoc.Paragraphs(1).Text
oDoc.Close False

But if you need the first line of the first paragraph, or the first line
of the first non-empty paragraph in the document, or something else,
things are a bit more complicated.
 
Top