-
OK, OK, here is how you get the result that will do it by searched folder, not filename.
[vba]
Dim var
Dim msg As String
With Application.FileSearch
.FileName = ".dot"
.LookIn = "c:\test"
.SearchSubFolders = True
.Execute (msoSortByNone)
If .FoundFiles.Count > 0 Then
For var = 1 To .FoundFiles.Count
msg = msg & .FoundFiles(var) & _
vbCrLf
Next
End If
End With
Selection.TypeText Text:=msg[/vba]
Result:
C:\Test\Appointment Template Gerry.dot
C:\Test\Appointment Template Health CentreGJK.dot
C:\Test\Change_Observation_Ver._7.1.dot
C:\Test\CVConversion.dot
C:\Test\DifferentHeaders.dot
C:\Test\PPRTemplate.dot
C:\Test\tektips.dot
C:\Test\test2\Restart NumberingGerry.dot
C:\Test\VBA_WorkDocs\checkvar.dot
C:\Test\VBA_WorkDocs\VBAExpress.dot
Notice the order is:
C:\Test
C:\Test\test2
C:\Test\VBA_WorkDocs
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