Hi, would it be possible to have a warning box pop up to prevent saving the PDF over an existing file? Also, can we have the box show the existing filename and be able to change the name and then save it? Thanks
Code:
Sub DETAIL_PDF()
Dim response As String
Dim PrintAreaString As String
response = InputBox("Enter column letter for 2nd part of range", "Enter Data")
If response = Cancel Then
Exit Sub
End If
Application.ScreenUpdating = False
With ActiveSheet
PrintAreaString = "A3:$" & Trim(UCase(response)) & "$" & .Range("B1").Value
If response <> "" Then
.PageSetup.PrintArea = PrintAreaString
.PageSetup.Orientation = xlLandscape
.PageSetup.Zoom = False
.PageSetup.FitToPagesWide = 1
.PageSetup.FitToPagesTall = False
.PageSetup.LeftMargin = 36
.PageSetup.TopMargin = 72
.PageSetup.RightMargin = 36
.PageSetup.BottomMargin = 36
End If
End With
fileSaveName = ActiveWorkbook.Path & "\" & "FRIEDLAND QUOTE " & [B6] & " " & "JOB " & [B7] & " " & [A15] & " " & [AB15] & " " & [AD15] & [B9] & " PCS" & " " & Format(Date, "mmddyy")
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
fileSaveName _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True '(change this to "False" to prevent the file from opening after saving)
Application.ScreenUpdating = True
End Sub