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

  • Thread starter Thread starter pano
  • Start date Start date
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
 
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
 
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......
 
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

Save As Macro 2
Save file with todays date ref#11235 2
MACRO SAVE HELP 2
Macro to save file as different filename 6
Saving to USB Drive either D or E 1
Macro Time stamp Help 2
Macro HELP PLEASE 4
Simplify save code 11

Back
Top