Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TXT file import...how to process more than one

Status
Not open for further replies.

datavisions

Programmer
May 30, 2001
35
CA
I have code that will find the number of .TXT files in a folder. I normally only process the one that is usually found in the folder, but I need to know how to process as many .TXT files as are found. Has anyone done this before? Here's the code I use to identify ONE in the folder.

Public Function CheckAAFileExists() As Boolean
'searches the RECREPS folder for all files whose names begin with "AA" and end with ".TXT"
On Error GoTo Err_Handler

' .LookIn = "c:\FSS\IMFS\RECREPS\"

With Application.FileSearch
.LookIn = "c:\FSS\IMFS\RECREPS\"
.filename = "AA??????.TXT"
If .Execute() > 0 Then
MsgBox "There were " & .FoundFiles.Count & _
" AA file(s) found."
CheckAAFileExists = True
gblAAFileName = Dir ("c:\FSS\IMFS\RECREPS\AA??????.TXT")

Else
MsgBox "There were no AA files found."
CheckAAFileExists = False
gblAAFileName = " "
End If
End With

Exit Function
Err_Handler:
MsgBox "Error Number: " & Err.Number & " Error: " & Err.Description
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top