Hi
I have seen several examples of VBA to find files by file name or property, but is if possible to use VBA to search all files (not just excel) in a directory to find a particular word or phrase in the file?
Hi
I have seen several examples of VBA to find files by file name or property, but is if possible to use VBA to search all files (not just excel) in a directory to find a particular word or phrase in the file?
Hello NickyC,
Yes, you can. Depending on the number of files, their size, and number of words you are looking for it could take quite awhile to finish.
Sincerely,
Leith Ross
Remember To Do the Following....
1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.2. Thank those who have helped you by clicking the Starbelow the post.
3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
Thanks Leith
could you point me to the VBA commands (filesearch apparently no longer works)
or.. is it necessary to open each file to search it?
Hello NickyC,
What type of files do you want to examine?
Hi Leith
both word and excel files, if possible.
Hello NickyC,
The files would need to be opened to search them. Searching Word isn't too difficult. Would you be searching a specific sheet or sheets in Excel or all sheets within a workbook?
Hi Leith
I was really hoping to create a dialog box that would reproduce the functionality of the old search box in windows many years ago – when a single box allowed you to specify which directories to search, whether to search subdirectories, file names or partial file names, file types, words or whole phrases in documents, date created, file size etc. I can manage most of this because the search items are file properties, but was hoping for something equivalent to the “search in file contents” command
Hello NickyC,
I remember that dialog. I think it phased out of Windows with the release of Windows 2000. That is when Windows made the transition from FAT to NT file format. Unfortunately, I don't know of replacement for that dialog. Perhaps another member has some information that will help you.
Thanks Leith for your comments
I may try to create a dialog box based on your suggestion of opening files, and stick to using it one directory at a time.
It's another on the long list of useful features that Windows (doubtless for good reasons) has withdrawn over the years. I still pine for the capcity to record macros in PowerPoint, too!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks