I have the following code in one of my macros
Works great except for if the file name is already there. How can I give the option to save over the existing file, just as Excel normally would if you were trying SaveAs and then choosing a file from the list in a folder?
Code:
strFilename = Range("E2").Value OutPut = MsgBox("Choose the path where to save your file", vbOKOnly, "Select Folder")
With Application.FileDialog(msoFileDialogFolderPicker)
.Title = "Select a Folder"
.AllowMultiSelect = False
.InitialFileName = ThisWorkbook.Path & "\"
.Show
strFolder = .SelectedItems(1)
End With
'save the file
ActiveWorkbook.SaveAs Filename:=strFolder & "\" & strFilename
Works great except for if the file name is already there. How can I give the option to save over the existing file, just as Excel normally would if you were trying SaveAs and then choosing a file from the list in a folder?