I'm trying to get the name of the last file in a specified directory. The code that I have so far will get name of the first file. What do I need to change to get the last one?
Tanks for the help, Kopy
Here's my code :
===========================================================
Dim fname, fnamefull As String
Dim I As Variant
Set fs = CreateObject("Scripting.FileSystemObject")
Set fl = fs.GetFolder("C:\Consulting\PSoft")
For Each f In fl.Files
I = I + 1
fname = f.Name
fnamefull = fl & "\" & fname
DoCmd.TransferText acImportDelim, "", "BBP_DB", fnamefull, True, ""
If I = 1 Then
Exit Function
End If
Next
Tanks for the help, Kopy
Here's my code :
===========================================================
Dim fname, fnamefull As String
Dim I As Variant
Set fs = CreateObject("Scripting.FileSystemObject")
Set fl = fs.GetFolder("C:\Consulting\PSoft")
For Each f In fl.Files
I = I + 1
fname = f.Name
fnamefull = fl & "\" & fname
DoCmd.TransferText acImportDelim, "", "BBP_DB", fnamefull, True, ""
If I = 1 Then
Exit Function
End If
Next