best way to find

G

Guest

Hi;

I need to look up 1800+ items in over 600+ files.
items are listed in .txt format
files are in excel format.

I would rather not have to open/close the excel files.. (takes too long)

1) Is there a way to look these 1800 items up?
2) What is the best way to store the results.. in Excel, Txt or other..

I know I can shell to the cmd.exe and do find or findstr command string..
But doing this brings bad results.

All I need is the file names that contain the search string (item)

Does anyone have any ideas and sample code...

Thanks in advance for your time...

VB = 6.3
Office = 2003
XP
 
N

NickHK

I'm a bit confused, because although Excel can open open .txt files, they
are not Excel files.
You can use ADO to query the files, if they have database structure.
But you write "All I need is the file names", so can you use Dir() ?

NickHK
 
G

Guest

Look at the file Search object. It supports the functionality of the file
=>open dialog when you select tools at the top and then select Search
 
G

Guest

Hi NickHK;

I wrote a VB script that shells
cmd.exe /c command string
the searchstring is
dir /s /b c:\directory\*.exe |findstr /i "searchstring" >ouutput.txt

code I use is..
Dim RetVal
RetVal = Shell("C:\WINDOWS\SYSTEM32\CMD.EXE /C" + searchstring, 0)

when I execute this, it runs ok; but the resulting files created have bogus
data.

I am looking for a better way to gather data that is not bogus.


Thank for your help
 
N

NickHK

Sam,
Try a Dir() with ADO so you do not have to open each file in Excel.
Otherwis the bogus results are not an Excel issue.

NickHK
 
G

Guest

Hi NickHK;

Please explain ADO..
thanks;


NickHK said:
Sam,
Try a Dir() with ADO so you do not have to open each file in Excel.
Otherwis the bogus results are not an Excel issue.

NickHK
 
N

NickHK

ADO= Microsoft Active Data Objects 2.x
Basically, it enables you to query (using SQL syntax) an Excel (and other
formats) file, without having to "open" the file.
But the files need to be in a database structure, otherwise the results are
unpredictable..

NickHK
 
G

Guest

without having to "open" the file
should probably be
without having to "open" the file in Excel
<g>
 
N

NickHK

Tom,
I was hoping that the "" would be be noticed. Just to try to differentiate
from this method and Automation. <g>

NickHK
 
G

Guest

Hi;

One last question...
How do I tell the shell not to open more than 1 cmd.exe session at a time..
I have about 30 cmd.exe sessions running at one time.. I know this can not
be a good thing...
thanks
 
N

NickHK

Sam Hodo said:
Hi;

One last question...
How do I tell the shell not to open more than 1 cmd.exe session at a
time..
I have about 30 cmd.exe sessions running at one time.. I know this can not
be a good thing...
thanks
 

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