Overwriting a file automatically using saveas in a macro

S

Sam

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
 
B

Bob Phillips

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 said:
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?
 
F

Frank Kabel

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?
 
D

doesn't apply

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?
 
D

Dave Peterson

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.
 
Top