Hello,

I have this code that loops through networks folder/subfolders and search all files with plan in its name.

But it is take a long time to find all files, because of network folder, many subfolders and many files.

I have heard that it is possible to speed code up with shell object. Can anybody help me to get it to work with shell object?


Dim fso As FileSystemObject

Private Sub Command1_Click()

Dim fld As Folder

Dim ParentFolder As String

ParentFolder = "R: \Documents\Plans\"

' Set fso = New FileSystemObject

' Set fld = fso.GetFolder(""R: \Documents\Plans\")


Set objShell = CreateObject("Shell.Application")

Set fld = objShell.Namespace(ParentFolder)


RecursiveSearch fld, "plan.doc"


Set fld = Nothing

Set fso = Nothing

End Sub