2

I tried to save without warnings

ActiveWorkbook.SaveAs Filename:= _
        "C:\Users\Owner\Desktop\xxx\test.xlsx", _
        ConflictResolution:=xlLocalSessionChanges

But still getting this It is already exists do you want to replace thing

How can I save and replace without warnings ?

Buras
  • 3,069
  • 28
  • 79
  • 126

1 Answers1

10

Try wrapping it in an Application.DisplayAlerts = false at the start and Application.DisplayAlerts = true at the end. Something like:

Application.DisplayAlerts = False

ActiveWorkbook.SaveAs Filename:= _
        "C:\Users\Owner\Desktop\xxx\test.xlsx", _
        ConflictResolution:=xlLocalSessionChanges

Application.DisplayAlerts= True

http://msdn.microsoft.com/en-us/library/office/ff839782(v=office.15).aspx

sous2817
  • 3,915
  • 2
  • 33
  • 34
  • 3
    It's important to always set this back to true, even if the routine throws an error. [See this](http://stackoverflow.com/a/1038115/3198973) for more info. – RubberDuck May 29 '14 at 15:16