LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using .filesearch for text within a file


Is there a way to search for mutiples of specific text within a .txt
file. For instance I'm needing to find a constant value "Y31" and then
a variable value at the same time like "36601". These 2 values are not
in the same line. I do want this file opened once found. I'm currently
using .filesearch and have tried various wildcards, .textorproperty
techniques but have not found a solution. Thanks for any suggestions.

Current Code (does not completely do what I want to do):

Sub FindPOFile()
Dim I As Integer
Worksheets("Data").Select
Cells.Select
Selection.ClearContents
5 si = Worksheets("Setup").Range("C4")
With Application.FileSearch
..NewSearch
..LookIn = "\\txnt34\g-tx-virtual"
..TextOrProperty = si
..MatchTextExactly = True
..Filename = "*.txt"
..Execute


For I = 1 To .FoundFiles.Count

If I = 2 Then MsgBox ("More than one file was found matching your
criteria")

Workbooks.Open .FoundFiles(I)

Next I

End With
If I = 1 Then GoTo 5

Cells.Select
Selection.Copy
Windows("Outstanding PO Tool.xls").Activate
Sheets("Data").Select
ActiveSheet.Paste


--
Michael Wise
------------------------------------------------------------------------
Michael Wise's Profile: http://www.excelforum.com/member.php...fo&userid=6998
View this thread: http://www.excelforum.com/showthread...hreadid=530893

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Return most recent file in subdirectory with out using FileSearch Enohp Aikon Excel Programming 20 October 3rd 05 11:24 PM
FileSearch & .zip file keepITcool Excel Programming 0 April 14th 05 12:27 AM
Excel VBA - open text file, replace text, save file? Cybert Excel Programming 2 October 2nd 04 01:05 AM
importing text file, removing data and outputting new text file Pal Excel Programming 8 February 27th 04 08:32 PM
Multiple text criteria with FileSearch object? Ed[_9_] Excel Programming 1 September 23rd 03 09:26 PM


All times are GMT +1. The time now is 10:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"