ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Suppress error message with saveas (https://www.excelbanter.com/excel-programming/388766-suppress-error-message-saveas.html)

[email protected]

Suppress error message with saveas
 
In one particular section of my module, I'd like to perform a
workbook.saveas that will:

1.) suppress the "file already exists" error message (I can do that
with OnError..) 2.) always go ahead and save over the existing file
(how?)

(I saw someone had asked about a related situation, using On Error
GoTo 0 to move on to the next task instead of overwriting the existing
file...close but doesn't quite get me there) Help?


PCLIVE

Suppress error message with saveas
 
Maybe this:

Application.AlertBeforeOverwriting = False
Application.AlertBeforeOverwriting = True

HTH,
Paul

wrote in message
ups.com...
In one particular section of my module, I'd like to perform a
workbook.saveas that will:

1.) suppress the "file already exists" error message (I can do that
with OnError..) 2.) always go ahead and save over the existing file
(how?)

(I saw someone had asked about a related situation, using On Error
GoTo 0 to move on to the next task instead of overwriting the existing
file...close but doesn't quite get me there) Help?




Dave Peterson

Suppress error message with saveas
 
You can use something like:

Application.displayalerts = false
'your code to save the workbook here
application.displayalerts = true

to suppress that warning dialog.

wrote:

In one particular section of my module, I'd like to perform a
workbook.saveas that will:

1.) suppress the "file already exists" error message (I can do that
with OnError..) 2.) always go ahead and save over the existing file
(how?)

(I saw someone had asked about a related situation, using On Error
GoTo 0 to move on to the next task instead of overwriting the existing
file...close but doesn't quite get me there) Help?


--

Dave Peterson

Vergel Adriano

Suppress error message with saveas
 
Hi,

Try it this way

Application.DisplayAlerts = False
ThisWorkbook.SaveAs "C:\sample.xls"
Application.DisplayAlerts = True



--
Hope that helps.

Vergel Adriano


" wrote:

In one particular section of my module, I'd like to perform a
workbook.saveas that will:

1.) suppress the "file already exists" error message (I can do that
with OnError..) 2.) always go ahead and save over the existing file
(how?)

(I saw someone had asked about a related situation, using On Error
GoTo 0 to move on to the next task instead of overwriting the existing
file...close but doesn't quite get me there) Help?



[email protected]

Suppress error message with saveas
 
Thank you, thank you, and thank you!

On May 4, 9:53 am, Dave Peterson wrote:
You can use something like:

Application.displayalerts = false
'your code to save the workbook here
application.displayalerts = true

to suppress that warning dialog.

wrote:

In one particular section of my module, I'd like to perform a
workbook.saveas that will:


1.) suppress the "file already exists" error message (I can do that
with OnError..) 2.) always go ahead and save over the existing file
(how?)


(I saw someone had asked about a related situation, using On Error
GoTo 0 to move on to the next task instead of overwriting the existing
file...close but doesn't quite get me there) Help?


--

Dave Peterson





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

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