|
-
May 13th, 2010, 11:13 AM
#1
Loop through folders with shell object.
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|