![]() |
VBA equivalent of findstr
Hi,
Can you help me with the VBA code equivalent of this command line: findstr /M /G:c:\search\pattern.txt e:\data\activity*.DAT R:\results\found_file_names.txt whe findstr = finds strings /M = print only the filename if a file contains a match /G = get the search strings from the file c:\search\pattern.txt e:\data\activity*.DAT = search all the activity*.DAT files lik activity1.DAT, activity2.DAT, etc. R:\results\found_file_names.txt = this is the file that will contai the results of the search (the results will be just the file names tha contain the search string) With this working, I need to load the results into a spreadsheet. Appreciate it -- Message posted from http://www.ExcelForum.com |
VBA equivalent of findstr
In the debug window type instr( and read the popup
----- lothario wrote: ----- Hi, Can you help me with the VBA code equivalent of this command line: findstr /M /G:c:\search\pattern.txt e:\data\activity*.DAT R:\results\found_file_names.txt whe findstr = finds strings /M = print only the filename if a file contains a match /G = get the search strings from the file c:\search\pattern.txt e:\data\activity*.DAT = search all the activity*.DAT files like activity1.DAT, activity2.DAT, etc. R:\results\found_file_names.txt = this is the file that will contain the results of the search (the results will be just the file names that contain the search string) With this working, I need to load the results into a spreadsheet. Appreciate it. --- Message posted from http://www.ExcelForum.com/ |
VBA equivalent of findstr
see the help on the filesearch object for a VBA method. There may be a
closer equivalent in one of the scripting libraries. -- Regards, Tom Ogilvy "lothario " wrote in message ... Hi, Can you help me with the VBA code equivalent of this command line: findstr /M /G:c:\search\pattern.txt e:\data\activity*.DAT R:\results\found_file_names.txt whe findstr = finds strings /M = print only the filename if a file contains a match /G = get the search strings from the file c:\search\pattern.txt e:\data\activity*.DAT = search all the activity*.DAT files like activity1.DAT, activity2.DAT, etc. R:\results\found_file_names.txt = this is the file that will contain the results of the search (the results will be just the file names that contain the search string) With this working, I need to load the results into a spreadsheet. Appreciate it. --- Message posted from http://www.ExcelForum.com/ |
All times are GMT +1. The time now is 03:00 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com