I tried to add csv files from download folder to current workbook. The process is interrupted and asking whether I want to save changes to csv file.
How to disable the save changes box ?
How to disable the save changes box ?
VBA Code:
Sub AddCSV()
Path = "C:\Users\My\Downloads\"
Filename = Dir(Path & "*.csv")
' Disable Screen Updating is used to stop screen flickering and Disable Events is used to avoid interrupted dialog boxes / popups
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
Do While Filename <> ""
Workbooks.Open Filename:=Path & Filename, ReadOnly:=True
For Each sheet In ActiveWorkbook.Sheets
sheet.Copy After:=ThisWorkbook.Sheets(1)
Next sheet
Workbooks(Filename).Close
Filename = Dir()
Loop
End Sub