How would this macro be modified to advise user the file exists (value in M3) ?
Code:
Option Explicit
Sub SavAsPDF()
On Error Resume Next
Dim FileSelected As String
Dim Path As String
Dim x As String
'#####################################
x = Sheets("Sheet1").Range("M3").Value '<--- Edit this to your sheet and cell
'#####################################
FileSelected = Application.GetSaveAsFilename(InitialFileName:=x, _
FileFilter:="PDF Files (*.pdf), *.pdf", _
Title:="Save PDF as")
If Not FileSelected <> "False" Then
MsgBox "You have cancelled"
Exit Sub
End If
ActiveWorkbook.ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Path & FileSelected & ".pdf", OpenAfterPublish:=False
MsgBox "File saved to : " & FileSelected
End Sub