title: How to avoid "A file named ... already exists in this location. Do you want to replace it?" prompt on subsequent save?
body: <p>I save all worksheets in a workbook as individual CSV files.</p>
  
  <p>If I make a change to any of the worksheets and run the macro again, it prompts me with the "A file named ... already exists in this location. Do you want to replace it?".</p>
  
  <p><a href="https://i.stack.imgur.com/IShR5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IShR5.png" alt="Replace Prompt for each and every worksheet"></a></p>
  
  <p>If I click Yes, the prompt comes up for every worksheet. If I click no, the macro throws an error.</p>
  
  <p><a href="https://i.stack.imgur.com/amxEo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/amxEo.png" alt="Macro error if on clicking &#39;No&#39;"></a></p>
  
  <p>Is there a way to avoid the prompt?</p>
  
  <pre><code>Sub CSVAutomation()
  Dim ws As Worksheet, wb As Workbook
  Dim pathh As Variant
  
  Set wb = ActiveWorkbook
  
  With Application.FileDialog(msoFileDialogFolderPicker)
      .AllowMultiSelect = False
      If .Show = -1 Then  'a folder was picked
         pathh = .SelectedItems(1)
      End If
  End With
  
  If pathh = False Then Exit Sub   'no folder picked; pathh is false
  
  Application.ScreenUpdating = False
  For Each ws In wb.Sheets(Array("01 - Currencies", ...."14 - User Defined
   Fields"))
      ws.Copy
      With ActiveWorkbook
          'Application.DisplayAlerts = False   'to avoid overwrite warnings
          '  pathh is a string (variant) of the path of the folder; does not 
   need pathh.Path
          .SaveAs pathh &amp; "\" &amp; ws.Name, xlCSV
          .Close SaveChanges:=False
      End With
  Next ws
  
  Application.ScreenUpdating = True
  
  End Sub
  </code></pre>