ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Overwriting a file automatically using saveas in a macro (https://www.excelbanter.com/excel-programming/297177-overwriting-file-automatically-using-saveas-macro.html)

Sam

Overwriting a file automatically using saveas in a macro
 
I don't see this option in saveas. Is there another way to avoid the overwite dialog box when overwriting a file with a macro?
Thanks

Bob Phillips[_6_]

Overwriting a file automatically using saveas in a macro
 
Hi Sam,

Precede the code with

Application.DisplayAlerts = False

and reset to true afterwards

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Sam" wrote in message
...
I don't see this option in saveas. Is there another way to avoid the

overwite dialog box when overwriting a file with a macro?
Thanks




Frank Kabel

Overwriting a file automatically using saveas in a macro
 
Hi
use
application.displayalerts = false
before your statement and
application.displayalerts = True
after this

-----Original Message-----
I don't see this option in saveas. Is there another way

to avoid the overwite dialog box when overwriting a file
with a macro?
Thanks
.


doesn't apply

Overwriting a file automatically using saveas in a macro
 
displayalerts does not work with the overwrite msgbox of SaveAs

----- Frank Kabel wrote: ----

H
us
application.displayalerts = fals
before your statement and
application.displayalerts = Tru
after thi

-----Original Message----
I don't see this option in saveas. Is there another way

to avoid the overwite dialog box when overwriting a file
with a macro?
Thank



Frank Kabel

Overwriting a file automatically using saveas in a macro
 
Hi
works for me.you may post the relevant part of your code

-----Original Message-----
displayalerts does not work with the overwrite msgbox of

SaveAs!

----- Frank Kabel wrote: -----

Hi
use
application.displayalerts = false
before your statement and
application.displayalerts = True
after this

-----Original Message-----
I don't see this option in saveas. Is there

another way
to avoid the overwite dialog box when overwriting a

file
with a macro?
Thanks
.

.


Dave Peterson[_3_]

Overwriting a file automatically using saveas in a macro
 
It's always worked for me, too.

But maybe you could just kill the existing name first.

on error resume next
kill myFileNameWithPathHere
on error goto 0
'do your save

The "on error resume next" says to ignore any error if the file doesn't actually
exist.



doesn't apply wrote:

displayalerts does not work with the overwrite msgbox of SaveAs!

----- Frank Kabel wrote: -----

Hi
use
application.displayalerts = false
before your statement and
application.displayalerts = True
after this

-----Original Message-----
I don't see this option in saveas. Is there another way

to avoid the overwite dialog box when overwriting a file
with a macro?
Thanks
.


--

Dave Peterson



All times are GMT +1. The time now is 08:34 AM.

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