ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem: FileSearch .TextOrProperty WIth Phrase Containing Blanks (https://www.excelbanter.com/excel-programming/417881-problem-filesearch-textorproperty-phrase-containing-blanks.html)

ChristopherL

Problem: FileSearch .TextOrProperty WIth Phrase Containing Blanks
 
The following code will return files containing the phrase: Chris Ate
His Big Lunch which I do not want. I want to get files containing only
the phrase "Chris Ate His Lunch"

With Application.FileSearch
.NewSearch
.LookIn = Folder
.SearchSubFolders = False
.TextOrProperty = "Chris Ate His Lunch"
.filename = "*.txt*"
.MatchTextExactly = True

.Execute

For file_no = 1 To .FoundFiles.Count

Debug.Print .FoundFiles(file_no)

Next

End With

Thank you,
Chris


All times are GMT +1. The time now is 07:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com