Seaching for files and folder

  • Thread starter myles_everblue via AccessMonster.com
  • Start date
M

myles_everblue via AccessMonster.com

Does anyone know how can i search files and folders? I have this code but it
only searches for a file and not a folder.
With Application.FileSearch
.NewSearch
.LookIn = gPathName
.SearchSubFolders = True
.FileName = strCode
.MatchTextExactly = True
.FileType = msoFileTypeAllFiles

If .Execute > 0 Then
MsgBox "There were" & .FoundFiles.Count & _
"file(s) found."
For i = 1 To .FoundFiles.Count
MsgBox .FoundFiles(i)
Next i
Else
IntRes = MsgBox("There were No Folder found." & _
"Do you want to Create folder?", vbYesNo + vbQuestion)

If IntRes = vbNo Then
Exit Sub
Else
MkDir gPathName & strCode
MsgBox "Folder" & strCode & "has been created", vbOKOnly +
vbInformation

End If

End If
End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top