Hopefully someone can resolve this problem for me.
I have an Excel 97 workbook which consolidates data on a monthly basis from 5 different text files (semi-colon delimited). I have written a macro for each workbook which opens the relevant file, copies the data to a worksheet in my main workbook, formats the data and then closes the text file. I then have a separate macro that calls these macros one by one to run the whole process. Except that the text files won't close, which then causes an error in the next macro when the next macro is called. I have tried:
Workbooks(MonthName & "Staff.txt".Close savechanges:=False
(where MonthName is a variable)
and
ActiveWorkbook.Close
but the file refuses to close. If I then try to close the text file manually, it won't close. The only way I can close the file is to shut down Excel altogether.
I've tried searching the MS Knowledge Base but have not found anything that refers to this problem. A similar search through this forum also came up blank. Is this a known probelm with Excel? Does anyone know why this happens and how I can resolve this?
TIA
Lightning
I have an Excel 97 workbook which consolidates data on a monthly basis from 5 different text files (semi-colon delimited). I have written a macro for each workbook which opens the relevant file, copies the data to a worksheet in my main workbook, formats the data and then closes the text file. I then have a separate macro that calls these macros one by one to run the whole process. Except that the text files won't close, which then causes an error in the next macro when the next macro is called. I have tried:
Workbooks(MonthName & "Staff.txt".Close savechanges:=False
(where MonthName is a variable)
and
ActiveWorkbook.Close
but the file refuses to close. If I then try to close the text file manually, it won't close. The only way I can close the file is to shut down Excel altogether.
I've tried searching the MS Knowledge Base but have not found anything that refers to this problem. A similar search through this forum also came up blank. Is this a known probelm with Excel? Does anyone know why this happens and how I can resolve this?
TIA
Lightning