christinefox
New Member
- Joined
- May 13, 2018
- Messages
- 2
Hello,
You wonderful skilled people have assisted me in the past and I would be very grateful if you could advise an amendment to the current RDB Email to PDF code I have in my Excel Spread sheet that currently works wonderfully.
I would like to add a few features and I have no idea how to do this.
That being: the client name added plus also add the dates relating to the invoice period IE from O29 (word to) Q29
Of which will add to the email with the PDF attached to say " Hi Mary, "The client Christian Name is in CELL O24
Please kindly find attached invoice for the period dates (detailed in O19 to Q19) IE 1 Dec to 30 Dec.
This is the current code and I would be enormously grateful for any assistance
You wonderful skilled people have assisted me in the past and I would be very grateful if you could advise an amendment to the current RDB Email to PDF code I have in my Excel Spread sheet that currently works wonderfully.
I would like to add a few features and I have no idea how to do this.
That being: the client name added plus also add the dates relating to the invoice period IE from O29 (word to) Q29
Of which will add to the email with the PDF attached to say " Hi Mary, "The client Christian Name is in CELL O24
Please kindly find attached invoice for the period dates (detailed in O19 to Q19) IE 1 Dec to 30 Dec.
This is the current code and I would be enormously grateful for any assistance
VBA Code:
ub RDB_Selection_Range_To_PDF_And_Create_Mail()
Dim FileName As String
If ActiveWindow.SelectedSheets.Count > 1 Then
MsgBox "There is more then one sheet selected," & vbNewLine & _
"ungroup the sheets and try the macro again"
Else
'Call the function with the correct arguments
'For a fixed range use this line
FileName = RDB_Create_PDF(Source:=IIf(Range("R73").Value = "0", Range("M14:T45"), Range("M14:T73")), _
FixedFilePathName:="", _
OverwriteIfFileExist:=True, _
OpenPDFAfterPublish:=False)
'For the selection use Selection in the Source argument
'FileName = RDB_Create_PDF(Source:=Selection)
'For a fixed file name use this in the FixedFilePathName argument
'FixedFilePathName:="C:\Users\Ron\Test\YourPdfFile.pdf"
If FileName <> "" Then
RDB_Mail_PDF_Outlook FileNamePDF:=FileName, _
StrTo:=ActiveSheet.Range("K2").Value, _
StrCC:="", _
StrBCC:="", _
StrSubject:="Gold Coast Storage Co", _
Signature:=True, _
Send:=False, _
StrBody:="<H4>Hi <br>" & _
"<body>I hope all is well with you. " & _
"<br><br>" & "Please kindly find attached invoice for storage <br><br>Have a great day! " & _
"<br><br>" & "Cheers!</H4></body>"
Else
MsgBox "Not possible to create the PDF, possible reasons:" & vbNewLine & _
"Microsoft Add-in is not installed" & vbNewLine & _
"You Canceled the GetSaveAsFilename dialog" & vbNewLine & _
"The path to Save the file in arg 2 is not correct" & vbNewLine & _
"You didn't want to overwrite the existing PDF if it exist"
End If
End If
End Sub