I've tried to adapt some old code to recursively check for word files in the
target directory so I can open each one and inspect the contents with VBA
(per my previous post). Unfortunately, the following code appears to hang on
the .execute command. Right now, the test directory has about 50 files and
no subdirectories. CPU and network access are nominal, so AFAIK this doesn't
appear to be a situation where it is just taking forever to execute
(although I welcome suggestions on how to know for sure).
Is my syntax wrong, or can anyone suggest alternative troubleshooting?
Thanks,
Keith
Sub FindAllTxtFiles() 'finds all .doc files in the target directory
DirPath = "\\networkdrive\test" 'also tried with a trailing "\"
just in case it needed one
With Application.FileSearch
.NewSearch
.LookIn = DirPath 'selected directory
.SearchSubFolders = True
.FileName = "*.doc"
If .Execute > 0 Then '*** stops here ***
For i = 1 To .FoundFiles.Count
'Do my file processing here
MsgBox FileName
Next i
End If
End With
End Sub
Karl E. Peterson - 24 Mar 2008 21:03 GMT
I have no idea why the object model may be breaking down here. But if you'd like to
do a "pure VB(A)" recursive search, see http://vb.mvps.org/samples/DirDrill for a
drop-in ready class module. Black boxes are *always* better when they're
transparent! :-)

Signature
.NET: It's About Trust!
http://vfred.mvps.org
> I've tried to adapt some old code to recursively check for word files in the
> target directory so I can open each one and inspect the contents with VBA
[quoted text clipped - 28 lines]
>
> End Sub
Doug Robbins - Word MVP - 25 Mar 2008 09:46 GMT
I had intended the counters only to be used for the tables and the rows
within them.

Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
> I've tried to adapt some old code to recursively check for word files in
> the target directory so I can open each one and inspect the contents with
[quoted text clipped - 28 lines]
>
> End Sub