Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 320
  • Last Modified:

Search directory with Word documents for docs containing a word from Access 2007

From Access 2007, I would like to search a directory containing Word documnets and find documents that contain a specific word in the body, then write that file name to a table.
0
dgravitt
Asked:
dgravitt
  • 4
  • 4
1 Solution
 
danishaniCommented:
Check this demo out (see attached).
SaveWordDoc.zip

Set References to Microsoft Script Runtime and Microsoft Word 12.0 Object.

Make sure you change the Pathname accordingly in the OnClick Event of the Command button.

Post back with questions.

Hope this helps,
Daniel
0
 
danishaniCommented:
Newer version, with better releasing of the Objects and releasing the WINWORD.EXE instance from memory.

 SaveWordDoc-v2.zip

Hope this helps,
Daniel
0
 
dgravittAuthor Commented:
Not sure I understand where to insert the directory name where the files are located.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
danishaniCommented:
Below new demo, including the option on Form to change Directory and option Incl. SubDir.

 SaveWordDoc-v3.zip

Hope this helps,
Daniel
0
 
dgravittAuthor Commented:
This is going to work great. But, I'm getting an error 3420: Object invalid or no longer set. Seems like it is occuring after finding the first file. I only have one record written to the table.
0
 
dgravittAuthor Commented:
Sometimes, before getting the error above, I get a warning this file is locked for editing. I presume it is on the next file found that meets the search criteria. The machine name is my PC that it says has the file locked.
0
 
danishaniCommented:
I think I released the Object to early, so adjusted the code a little.
See attached.

 SaveWordDoc-v4.zip
0
 
dgravittAuthor Commented:
Great solution. Thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now