ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,689
- Office Version
- 2007
- Platform
- Windows
Morning,
I have the code below but would like some advise for a slight alteration please as i got lost with the yes / no part of it..
The code saves a screen shot in the form of a PDF file.
The Yes / No box is where im stuck.
Clicking No would just continue to save as normal
Clicking Yes would save the file as normal BUT also open & print it
I have the code below but would like some advise for a slight alteration please as i got lost with the yes / no part of it..
The code saves a screen shot in the form of a PDF file.
The Yes / No box is where im stuck.
Clicking No would just continue to save as normal
Clicking Yes would save the file as normal BUT also open & print it
Code:
Private Sub Generate_Pdf_Click()
Dim strFileName As String
strFileName = "C:\Users\Ian\Desktop\REMOTES ETC\DR SCREEN SHOT PDF\" & Range("G13").Value & ".pdf"
If Dir(strFileName) <> vbNullString Then
MsgBox "INVOICE " & Range("G13").Value & " WAS NOT SAVED AS IT ALLREADY EXISTS", vbCritical + vbOKOnly, "GENERATE PDF FILE MESSAGE"
Exit Sub
End If
With ActiveSheet
.PageSetup.PrintArea = "$G$3:$O$61"
.ExportAsFixedFormat Type:=xlTypePDF, Filename:=strFileName, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False
MsgBox "INVOICE " & " WAS SAVED SUCCESSFULLY" & vbNewLine & "VIEW PDF FILE ?" & vbInformation + vbYesNo, "GENERATE PDF FILE MESSAGE"
ActiveWorkbook.Save
End With
End Sub