In Excel 2003, I called this function from within a loop that depends on the Dir function to obtain the next file in a folder. It appears that the embedded Dir call in this function interferes with the loop control use of the Dir function. Consider the following meta-code:
Sub ProcessWorkbooksInFolder(InputFolder As String, FileFilter As String)
Dim fn As String
Dim oLOG As String
oLOG = "C:\ErrorLog.txt"
fn = Dir(InputFolder & FileFilter) ' the first file name in the folder
Do While fn <> ""
Workbooks.Open InputFolder & fn
' ... Do Something ...
If FileFolderExists(oLOG) Then
fn = Dir ' the next file name in the folder