ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,226
- Office Version
- 2007
- Platform
- Windows
Morning,
The code below is 99% complete apart from printing the newly created PDF
Below is the current working code in use.
It does what i require BUT whenYES is selected on the MsgBox i currently have in place ("Hi")
This is where i would like to Hi with the code to print the current PDF
Many Thanks
The code below is 99% complete apart from printing the newly created PDF
Below is the current working code in use.
It does what i require BUT whenYES is selected on the MsgBox i currently have in place ("Hi")
This is where i would like to Hi with the code to print the current PDF
Rich (BB code):
Private Sub Generate_Pdf_Click()
Dim strFileName As String
strFileName = "C:\Users\Ian\Desktop\GRASS CUTTING\CURRENT GRASS SHEETS\FIONA RECEIPTS\" & "FIONA " & Range("J4").Value & ".pdf"
If Dir(strFileName) <> vbNullString Then
MsgBox "GENERATED PDF INVOICE" & vbNewLine & vbNewLine & "FIONA " & Range("J4").Value & vbNewLine & vbNewLine & "WAS NOT SAVED AS IT ALLREADY EXISTS", vbCritical + vbOKOnly, "GENERATE PDF FILE MESSAGE"
Exit Sub
End If
With ActiveSheet
.PageSetup.PrintArea = "$F$2:$K$60"
.ExportAsFixedFormat Type:=xlTypePDF, Filename:=strFileName, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False
pdf = MsgBox("GENERATED PDF INVOICE" & vbNewLine & vbNewLine & "FIONA " & Range("J4").Value & vbNewLine & vbNewLine & "WAS SAVED SUCCESSFULLY", vbInformation + vbOKOnly, "GENERATE PDF FILE MESSAGE")
End With
Dim answer As Integer
answer = MsgBox("DO YOU WISH TO PRINT THIS INVOICE ?", vbYesNo + vbInformation, "PRINT PDF FIONA MESSAGE")
If answer = vbNo Then
Range("J4").Value = Range("J4").Value + 1
Range("G27").Select
Exit Sub
Else
MsgBox ("Hi")
Range("J4").Value = Range("J4").Value + 1
Range("G27").Select
End If
End Sub
Many Thanks