ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,226
- Office Version
- 2007
- Platform
- Windows
Afternon,
I am using the code shown below to save the generated file as a pdf.
It takes the value from cell L4
So the generated saved file is just shown / called as 1,2,3 etc etc
Please can you advise how i insert into the code the word RECEIPT
I did try & RECEIPT where ive shown in Red but kept getting error messages.
Then the saved pdf will be saved like RECEIPT 1 RECEIPT 2 RECEIPT 3
Thanks
I am using the code shown below to save the generated file as a pdf.
It takes the value from cell L4
So the generated saved file is just shown / called as 1,2,3 etc etc
Please can you advise how i insert into the code the word RECEIPT
I did try & RECEIPT where ive shown in Red but kept getting error messages.
Then the saved pdf will be saved like RECEIPT 1 RECEIPT 2 RECEIPT 3
Thanks
Rich (BB code):
Private Sub Generate_Pdf_Click()
Dim strFileName As String
strFileName = "C:\Users\Ian\Desktop\REMOTES ETC\DR\GM PRODUCTIONS\" & Range("L4").Value & ".pdf"
If Dir(strFileName) <> vbNullString Then
MsgBox "GENERATED PDF INVOICE" & vbNewLine & vbNewLine & Range("L4").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:$N$61"
.ExportAsFixedFormat Type:=xlTypePDF, Filename:=strFileName, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False
pdf = MsgBox("GENERATED PDF INVOICE " & Range("L4").Value & vbNewLine & vbNewLine & "WAS SAVED SUCCESSFULLY", vbInformation + vbOKOnly, "GENERATE PDF FILE MESSAGE")
ActiveWorkbook.Save
End With
Range("L4").Value = Range("L4").Value + 1
Range("G27:L36").ClearContents
MsgBox "TEMPLATE CELLS HAVE NOW BEEN CLEARED", vbInformation, "CLEAR DESCRIPTION CELLS MESSAGE"
Range("G27").Select
End Sub