K
Kirk P.
This code is producing a run time 1004 "file not found" error, however it is
actually naming the file it can't find in the error message. It seems odd it
displays the name of the file if it can't find it. Here's the code - can
anyone spot the problem?
Sub RunLoop()
Dim Folder As String
Dim FName As String
Dim bk As Workbook
Folder = "C:\Databases\Paypal\Bank Files\Sales\"
FName = Dir(Folder & "*.CSV")
Do While FName <> ""
Set bk = Workbooks.Open(Filename:=FName)
'run my macro here
bk.Close savechanges:=True
FName = Dir()
Loop
End Sub
actually naming the file it can't find in the error message. It seems odd it
displays the name of the file if it can't find it. Here's the code - can
anyone spot the problem?
Sub RunLoop()
Dim Folder As String
Dim FName As String
Dim bk As Workbook
Folder = "C:\Databases\Paypal\Bank Files\Sales\"
FName = Dir(Folder & "*.CSV")
Do While FName <> ""
Set bk = Workbooks.Open(Filename:=FName)
'run my macro here
bk.Close savechanges:=True
FName = Dir()
Loop
End Sub