PDF to Email adding links to cells to be included in email body RDB Code

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

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
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,214,824
Messages
6,121,784
Members
449,049
Latest member
greyangel23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top