I would like a macro to close all open .csv files
macro tto close all csv files
Printable View
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
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