ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   pop ups after saving to csv via macro (https://www.excelbanter.com/excel-programming/275791-pop-ups-after-saving-csv-via-macro.html)

Jonathan[_5_]

pop ups after saving to csv via macro
 
I have the following simple macro to take data from an
excel sheet (which updates from DDE links) and save it as
a csv file. the problem is after I run it i get the
message:

"Do you want to save the changes you made to 'Daily
Updates.csv'? - to which I have to manually select yes
and then file closes. how do i get around this? Code
below:

Sub Create_CSV()
'
' Create_CSV Macro
'

'
Kill "C:\Data Updates\CSV\Daily Updates.csv"
ActiveWorkbook.Save
Sheets("DailyFeeder").Select
ActiveWorkbook.SaveAs Filename:= _
"C:\Data Updates\CSV\Daily Updates.csv", _
FileFormat:=xlCSV, CreateBackup:=False
ActiveWorkbook.Close


End Sub


P.S. when i open the excel file, it takes a minute or two
for the dde links to update. any way to put code in
another macro to open the file, let it wait 2 minutes and
then execute the above macro?

[Wizard]

pop ups after saving to csv via macro
 
Try

ActiveWorkbook.Close SaveChanges:=True

That should do it.

Graeme Redmond \(Gredmond\)

pop ups after saving to csv via macro
 
if you use the following snippet of code it will switch off most of the
prompts.


Application.DisplayAlerts=False


"Jonathan" wrote in message
...
I have the following simple macro to take data from an
excel sheet (which updates from DDE links) and save it as
a csv file. the problem is after I run it i get the
message:

"Do you want to save the changes you made to 'Daily
Updates.csv'? - to which I have to manually select yes
and then file closes. how do i get around this? Code
below:

Sub Create_CSV()
'
' Create_CSV Macro
'

'
Kill "C:\Data Updates\CSV\Daily Updates.csv"
ActiveWorkbook.Save
Sheets("DailyFeeder").Select
ActiveWorkbook.SaveAs Filename:= _
"C:\Data Updates\CSV\Daily Updates.csv", _
FileFormat:=xlCSV, CreateBackup:=False
ActiveWorkbook.Close


End Sub


P.S. when i open the excel file, it takes a minute or two
for the dde links to update. any way to put code in
another macro to open the file, let it wait 2 minutes and
then execute the above macro?




Tom Ogilvy

pop ups after saving to csv via macro
 
Actually, since the workbook has just been saved

ActiveWorkbook.Close SaveChanges:=False

my be a better choice.

--
Regards,
Tom Ogilvy

[Wizard] wrote in message
...
Try

ActiveWorkbook.Close SaveChanges:=True

That should do it.





All times are GMT +1. The time now is 07:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com