Saving a copy of excel file in macro but have it auto write

P

pano

I have the below Macro but would like it not to ask the user before
overwriting the file anyway to do this????

Sub AASAVETOSTICK()
' AASAVETOSTICK Macro
' Macro recorded 19/03/2007 by *
'
ChDir "D:\"
ActiveWorkbook.SaveAs Filename:="D:\DWS.xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=True
End Sub
 
P

Pete_UK

Try:

Application.DisplayAlerts = False

before the code to turn warning messages off, and

Application.DisplayAlerts =True

after the code to turn them back on.

Hope this helps.

Pete
 
P

pano

Try:

Application.DisplayAlerts = False

before the code to turn warning messages off, and

Application.DisplayAlerts =True

after the code to turn them back on.

Hope this helps.

Pete




- Show quoted text -

Thanks Pete thats the bit I was missing......
 
M

Mike

This should do it

Sub AASAVETOSTICK()
' AASAVETOSTICK Macro
' Macro recorded 19/03/2007 by *
Application.DisplayAlerts = False 'This will turn off the alert
ChDir "D:\"
ActiveWorkbook.SaveAs Filename:= _
"D:\DWS.xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=False
Application.DisplayAlerts = True 'This will turn back on the alert
End Sub
 

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

Similar Threads


Top