ksiva8
10-17-2011, 08:24 AM
Please please help: I am now infuriated and brain-tired of searching the web resource for this supposed simple code:
Can someone point me to a code which searches a given file directory by using a word search (like Window Explorer's Search)?
Also, I understand that there is a way to use keyword search to access the Document Properties of a Word file without opening the document - sound like optimal method perhaps.
I am stuck because 'Filesearch' was removed by MSoft, so following code no longer works: Thanks in antiicipation, VBAX newbie
Tag ...dim vsearch as string
Set fs = Application.FileSearch
With fs
.NewSearch
.LookIn = "C:\My Documents\SivaAM_Portable\News"
.TextOrProperty = vSearch
.MatchTextExactly = False
.FileType = msoFileTypeAllFiles
If .Execute() > 0 Then
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found."
If .FoundFiles.Count <> 0 Then
Documents.Add
ActiveDocument.SaveAs (vSearch)
Documents.Open (vSearch)
End If....
Can someone point me to a code which searches a given file directory by using a word search (like Window Explorer's Search)?
Also, I understand that there is a way to use keyword search to access the Document Properties of a Word file without opening the document - sound like optimal method perhaps.
I am stuck because 'Filesearch' was removed by MSoft, so following code no longer works: Thanks in antiicipation, VBAX newbie
Tag ...dim vsearch as string
Set fs = Application.FileSearch
With fs
.NewSearch
.LookIn = "C:\My Documents\SivaAM_Portable\News"
.TextOrProperty = vSearch
.MatchTextExactly = False
.FileType = msoFileTypeAllFiles
If .Execute() > 0 Then
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found."
If .FoundFiles.Count <> 0 Then
Documents.Add
ActiveDocument.SaveAs (vSearch)
Documents.Open (vSearch)
End If....