ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Searching for mutiple items in txt files (https://www.excelbanter.com/excel-programming/307111-searching-mutiple-items-txt-files.html)

Michael Wise[_2_]

Searching for mutiple items in txt files
 
I am searching a virtual printer for txt files with specific informatio
in them. I would however like for it to search for today's date as on
of 3 criteria's. Current code below is what i'm using but I have no
found a solution to getting it to see the date. FYI the report wil
contain the date as such 16-AUG-04 in txt. Any help here?

With Application.FileSearch
.NewSearch
.LookIn = "X:"
.TextOrProperty = "U246984 PCE REPORT"
.MatchTextExactly = False
.Filename = "*.txt"
.Execut

--
Message posted from http://www.ExcelForum.com


Dave Peterson[_3_]

Searching for mutiple items in txt files
 
I looked through help. I didn't see anything that said you get up to 3
criteria. Did I miss something?

..textorproperty = format(date,"dd-mmm-yy")

might work for you.

The other thing is that if your date is in a cell, and it's just formatted to
show dd-mmm-yy, it might not work at all.

I'd be very surprised to see filesearch find a date this way.

But if you actually had text in the cell '16-AUG-04
note leading apostrophe, then I bet it would work ok.

(all this is untested.)

"Michael Wise <" wrote:

I am searching a virtual printer for txt files with specific information
in them. I would however like for it to search for today's date as one
of 3 criteria's. Current code below is what i'm using but I have not
found a solution to getting it to see the date. FYI the report will
contain the date as such 16-AUG-04 in txt. Any help here?

With Application.FileSearch
NewSearch
LookIn = "X:"
TextOrProperty = "U246984 PCE REPORT"
MatchTextExactly = False
Filename = "*.txt"
Execute

---
Message posted from http://www.ExcelForum.com/


--

Dave Peterson


Michael Wise[_3_]

Searching for mutiple items in txt files
 
Thanks Dave,
But I have tried the format(dd-mmm-yy) did not work it caused it t
bypass all together. The file it is searching is still in text form an
so the date represented within that files date is formated dd-mmm-yy.
have even tried assigning a variable as well did not work there either


Other suggestions?

Michae

--
Message posted from http://www.ExcelForum.com


Dave Peterson[_3_]

Searching for mutiple items in txt files
 
If you do file|open, you can click on search (it's under Tools in xl2002).

Maybe you could search there and see if that helps. But if I put 08/19/2004 in
a cell (formatted for dd-mmm-yy) and then search for 19-aug-04, it didn't find
it.

Maybe you could search for the same format as your pc's short date format.

If you're not tied to VBA, maybe you could use Windows start button|search to
find it.



"Michael Wise <" wrote:

Thanks Dave,
But I have tried the format(dd-mmm-yy) did not work it caused it to
bypass all together. The file it is searching is still in text form and
so the date represented within that files date is formated dd-mmm-yy. I
have even tried assigning a variable as well did not work there either.

Other suggestions?

Michael

---
Message posted from http://www.ExcelForum.com/


--

Dave Peterson



All times are GMT +1. The time now is 05:47 AM.

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