Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50123

[SOLVED] Problem adding section into macro

$
0
0
Hi All,

I have a macro which creates a pdf, saves it and sends it in an email, but one thing I'm trying to add to the first part (export to pdf) is a "range" (i think).

Code:

Sub SendEmailPDFAdam()
    Dim FileName As String
    'Call the function with the correct arguments
    FileName = RDB_Create_PDF(ActiveWorkbook, "W:\Enquiry Forms\" & Format(Now(), "yymmdd hh.mm.ss") & ".pdf", True, True)
    If FileName <> "" Then
        RDB_Mail_PDF_Outlook FileName, "", "Customer Enquiry.", _
        "Customer enquiry for you." & vbNewLine & _
        "Please see the attached PDF for details." _
        & vbNewLine & vbNewLine & "Regards", False
    Else
        MsgBox "Not possible to create the PDF, possible reasons:" & vbNewLine & _
        "Microsoft Add-in is not installed" & vbNewLine & _
        "You cancelled 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 Sub

I'm guessing in the 4th line needs to be range or some reference point to "L1" as this will input the employee number in the PDF file name.

Any questions please ask!!

Thanks!!

Viewing all articles
Browse latest Browse all 50123

Trending Articles