It's 1:30am & here I am looking at macro code, I modified some code I already had & tested it as best I can. Hopefully it's what you're after
Option Explicit
Sub SaveAsMacro()
Dim strSaveAsName As String
On Error GoTo ErrorOut1
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=Environ("USERPROFILE") & "\SharePoint\OFS Operations - Job Briefing Recor\\" & Cells(2, 1).Value & " - " & Cells(2, 2).Value & " - " & Cells(3, 2).Value & ".pdf", _
OpenAfterPublish:=True
On Error GoTo 0
GoTo ExitOut
ErrorOut1:
On Error GoTo ExitOut ' If an error occurs in the SaveAs routine, end the macro
' Promp user for save particulars
strSaveAsName = Application.GetSaveAsFilename(FileFilter:="PDF Files (*.pdf), *.pdf", _
Title:="Select Folder And FileName To Save")
If strSaveAsName <> "False" Then ' Check user has entered save particulars
' Create the PDF & save it to SavedFileName variable destination
With ActiveSheet
.ExportAsFixedFormat Type:=xlTypePDF, Filename:=strSaveAsName, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
End With
Else ' Cancel button was pressed
GoTo ExitOut
Exit Sub
End If
GoTo ExitOut
ExitOut:
On Error GoTo 0
Exit Sub
End Sub
Bookmarks