Overwriting a file automatically using saveas in a macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top