Solved

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

Posted on 2011-09-19
8
274 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
ID: 36561211
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
ID: 36561342
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
ID: 36561613
Not sure I understand where to insert the directory name where the files are located.
0
 
LVL 12

Expert Comment

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

 SaveWordDoc-v3.zip

Hope this helps,
Daniel
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

Author Comment

by:dgravitt
ID: 36562116
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
ID: 36562231
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
ID: 36562340
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
ID: 36562450
Great solution. Thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is often necessary in this forum and others to illustrate Word fields as text with the field delimiters replaced with the curly brackets that the delimiters resemble when field codes are being displayed on the document. This means that the text c…
This is written from a 'VBA for MS Word' perspective, but I am sure it applies to most other MS Office components where VBA is used.  One thing that really bugs me is slow code, ESPECIALLY when it's mine!  In programming there are so many ways to…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
In a previous video Micro Tutorial here at Experts Exchange (http://www.experts-exchange.com/videos/1358/How-to-get-a-free-trial-of-Office-365-with-the-Office-2016-desktop-applications.html), I explained how to get a free, one-month trial of Office …

920 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

15 Experts available now in Live!

Get 1:1 Help Now