VBA equivalent of findstr

L

lothario

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

where:
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
 
G

Guest

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

where:
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.
 
T

Tom Ogilvy

see the help on the filesearch object for a VBA method. There may be a
closer equivalent in one of the scripting libraries.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top