Solved

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

Posted on 2011-09-19
8
264 Views
Last Modified: 2012-05-12
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
Comment
Question by:dgravitt
  • 4
  • 4
8 Comments
 
LVL 12

Expert Comment

by:danishani
Comment Utility
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
 
LVL 12

Expert Comment

by:danishani
Comment Utility
Newer version, with better releasing of the Objects and releasing the WINWORD.EXE instance from memory.

 SaveWordDoc-v2.zip

Hope this helps,
Daniel
0
 

Author Comment

by:dgravitt
Comment Utility
Not sure I understand where to insert the directory name where the files are located.
0
 
LVL 12

Expert Comment

by:danishani
Comment Utility
Below new demo, including the option on Form to change Directory and option Incl. SubDir.

 SaveWordDoc-v3.zip

Hope this helps,
Daniel
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

Author Comment

by:dgravitt
Comment Utility
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
 

Author Comment

by:dgravitt
Comment Utility
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
 
LVL 12

Accepted Solution

by:
danishani earned 500 total points
Comment Utility
I think I released the Object to early, so adjusted the code a little.
See attached.

 SaveWordDoc-v4.zip
0
 

Author Closing Comment

by:dgravitt
Comment Utility
Great solution. Thanks
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Introduction This tutorial provides instructions on how to properly format your Word document using the inbuilt tools provided. The benefits of using these tools means your documents are more accessible and easily portable to other applications an…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now