Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 312
Default Save as Overwrite prompt

Sub Save_Book()
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=filepath & "VA05.xls"
Application.DisplayAlerts = True
End Sub

I want to save a file and automatically overwrite the existing file. I have
done this a thousand times, and it works fine. But now I am exporting a
report from an ERP system into Excel. When I run this code against the
resulting excel file, I get an error Method 'Display Alerts' of object
'Application' failed. Is there another way of Saving a file without being
prompted to overwrite or not? (I want the default to be Yes overwrite).
Thanks!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Save as Overwrite prompt

Maybe you could just delete the file (or at least try to):

on error resume next
kill filepath & "VA05.xls"
on error goto 0

activeworkbook.saveas filename:=filepath & "VA05.xls"

===
But I think I'd try to find out why that .displayalerts is breaking. I don't
recall ever seeing it break.

Steph wrote:

Sub Save_Book()
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=filepath & "VA05.xls"
Application.DisplayAlerts = True
End Sub

I want to save a file and automatically overwrite the existing file. I have
done this a thousand times, and it works fine. But now I am exporting a
report from an ERP system into Excel. When I run this code against the
resulting excel file, I get an error Method 'Display Alerts' of object
'Application' failed. Is there another way of Saving a file without being
prompted to overwrite or not? (I want the default to be Yes overwrite).
Thanks!


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
getting rid of copy/overwrite prompt on Save John Collins Excel Discussion (Misc queries) 2 November 21st 06 11:59 PM
save prompt for user exit, but no save prompt for batch import? lpj Excel Discussion (Misc queries) 1 February 25th 06 02:08 AM
Overwrite existing file without prompt Mark Excel Programming 0 September 17th 04 01:21 PM
Save As without overwrite prompt Fred Smith Excel Programming 2 March 3rd 04 01:23 PM
Prompt to overwrite Karen[_10_] Excel Programming 2 October 16th 03 08:24 PM


All times are GMT +1. The time now is 10:52 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"