Opening office documents - minus application object

I

Irwin Williams

Hi,
I'm using MS Access to crawl thru my file server and for all office files
get their properties.
MS released a dll that does this nicely (dsofile.dll).
However, I would also like to grab all the text out of specified documents
(.doc) but my current solution is (to me) too cumbersome.
this is a snippet:
<snippet>
Public Function getWordDocText(strFileName As String)
On Error GoTo Handle_Err:
Dim WordApp As Word.Application
Dim WordDoc As Word.Document
Dim copiedText As String

Set WordApp = CreateObject("word.application")
WordApp.Visible = False
WordApp.DisplayScreenTips = False
WordApp.DisplayAlerts = wdAlertsNone
If WordApp.Documents.Open(fileName:=strFileName).HasPassword Then
WordApp.ActiveDocument.Close
WordApp.Quit
Set WordApp = Nothing
Set WordDoc = Nothing
Exit Function
End If
Set WordDoc = WordApp.Documents.Open(fileName:=strFileName,
ReadOnly:=True)
'if you want to watch the selection process then make word visible
getWordDocText = WordDoc.Content.Text
'close it up
WordApp.ActiveDocument.Close
WordApp.Quit
Set WordApp = Nothing
Set WordDoc = Nothing
Exit Function
Handle_Err:
Call RecordError("m: getWordDocText > " & strFileName, Err.Number & " |
| " & Err.Description)
Resume Next
End Function
</snippet>
What the above code does is for a given document, it opens up the file,
using a word application object, uses the object to get its text and closes
up everything.
I have a couple thousand files, and a win98 machine.
I would love to know if there is a way around using the MS word application
object.
My question is inspired from the fact that win2k can do a full text search
of office documents, without having the office suite installed. I want to
do the same

Is this possible? Also, if anyone on this list knows of other lists i can
chk i would appreciate it

/irwin
 
I

Irwin Williams

Hey,
In reply to this, some trolling around took me to two tools that kinda does
what I want to do ... i would appreciate help from anyone with insight into
how they work ...
1. Google Desktop Search (http://desktop.google.com) works by indexing
certain files on a person's hard drive (inclusive of O2k+ files).
2. Powergrep
This is a windows based program similar to the linux grep util. It is used
to search for text in files.
Anyone with insight into how i can port their functionality into a vba
context for word documents?

/irwin
 

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

Top