Try this:
Option Explicit
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim fFullPathName As String, fTEST As String
Application.EnableEvents = False
fFullPathName = Sheets("Input Sheet").Range("B1").Value
'Test if file already exists
If Len(Dir(fFullPathName)) > 0 Then
If MsgBox("The file '" & fFullPathName & "' already exists. Do you wish to overwrite it?", vbExclamation + vbYesNo) = vbYes Then
Application.DisplayAlerts = False
Cancel = True
ThisWorkbook.Save
Application.EnableEvents = True
Exit Sub
End If
End If
fTEST = SaveItAs(fFullPathName)
Application.DisplayAlerts = False
If fTEST <> "False" And fTEST > "" Then ThisWorkbook.SaveAs fTEST
Cancel = True
Application.EnableEvents = True
End Sub
Function SaveItAs(MyFile As String) As String
On Error GoTo ErrorExit
With Application.FileDialog(msoFileDialogSaveAs)
.AllowMultiSelect = False
.ButtonName = "&Save As"
.InitialFileName = MyFile
.Title = "File Save As"
'.Execute
.Show
SaveItAs = .SelectedItems(1)
End With
ErrorExit:
End Function
Bookmarks