Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2005

Tip: Looking for answers? Try searching our database.

Opening office documents - minus application object

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Irwin Williams - 14 Jan 2005 13:57 GMT
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
Jonathan West - 14 Jan 2005 14:27 GMT
Already answered in the word.vba.general group. Please do not post multiple
copies of the same question to different groups.

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup

> Hi,
> I'm using MS Access to crawl thru my file server and for all office files
[quoted text clipped - 53 lines]
>
> /irwin

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.