Getting text from a Word Document

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top