Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Return most recent file in subdirectory with out using FileSearch | Excel Programming | |||
FileSearch & .zip file | Excel Programming | |||
Excel VBA - open text file, replace text, save file? | Excel Programming | |||
importing text file, removing data and outputting new text file | Excel Programming | |||
Multiple text criteria with FileSearch object? | Excel Programming |