Creating and closing CSV file

D

davidakemp

I have a macro that opens a new workbook, copies a range and pastes i
into the new workbook, and then closes the new workbook as a CS
format. Everything works fine except that a window opens that asks i
I want to save changes to the CSV file. Clicking "Yes" in this bo
causes the macro to complete and the file is saved as desired. I
there a way to keep this "Save Changes in file xxxxx.csv" box fro
opening?
Thank
 
N

Nate Oliver

Hello David

The following works for me

Sub SvCsvFile(
Dim nwBook As Workboo
Set nwBook = Workbooks.Ad
With Applicatio
.ScreenUpdating = Fals
'Only to kill overwrite dialo
.DisplayAlerts = Fals
End Wit
ThisWorkbook.Sheets(1).Range("a1:b20").Copy
nwBook.Sheets(1).Range("a1"
nwBook.Close True, "c:\temp\test.csv
With Applicatio
.ScreenUpdating = Tru
.DisplayAlerts = Tru
End Wit
Set nwBook = Nothin
End Su

Regards
Nate Oliver
 
D

davidakemp

Nate,

Thanks for the help. The following solved the issue:

With Application
.DisplayAlerts = False
End With

I appreciate your input,
Davi
 
Top