avoiding dialog boxes in macros

B

Bruce Bowler

I have a script that I'm working on that, among other things may try and
write a file that already exist. Currently, it pops up a dialog box and
stalls the process. I'd like to not have the dialog boxes come up, but
rather simply overwrite the file. What option(s) do I need to specify to
accomplish that goal?

Bruce

--
+-------------------+---------------------------------------------------+
Bruce Bowler | When your illusions are gone you have ceased to
1.207.633.9600 | live. - Anonymous
(e-mail address removed) |
+-------------------+---------------------------------------------------+
 
P

pfsardella

Application.DisplayAlerts = False
' Your code here to overwrite file.
Application.DisplayAlerts = True

HTH
Paul
 
T

Tom Ogilvy

if it is a workbook

Application.DisplayAlerts = False
thisworkbook.SaveAs . . .
Application.DisplayAlerts = True

An alternative is

fName = "C:\Whatever.xls"
On error resume next
kill fname
On Error goto 0
Thisworkbooks.SaveAs fName
 

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

Top