I would like a macro to close all open .csv files
macro tto close all csv files
I would like a macro to close all open .csv files
macro tto close all csv files
Use this
Code:Sub CloseCSV() Dim wbk As Workbook For Each wbk In Workbooks If wbk.FileFormat = 6 Then wbk.Close 0 End If Next wbk End Sub
A dream is not something you see when you are asleep, but something you strive for when you are awake.
It's usually a bad idea to say that something can't be done.
The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve
Join us at Facebook
Hi
Thanks for the help, much appreciated
Hi ExcelFox
I while back you provided me with code to close csv files that are open.It worked previosly, but when using it, one of the csv files won't close called
BR1 SalesLedgerOutstandingTransactions.csv
It would be appreciated if you would assist
Code:For Each wbk In Workbooks If wbk.FileFormat = 6 Then wbk.Close 0 End If Next wbk End Sub
Check the fiteformat of that file.
Thanks for the reply
I sorted out the problem, by amending the code slightly
Code:For Each wbk In Workbooks If wbk.FileFormat = xlcsv Then wbk.Close End If Next wbk End Sub
Bookmarks