How to export multiple reports & attach to same email (1 Viewer)

Neobeowulf

Registered User.
Local time
Today, 05:42
Joined
May 31, 2012
Messages
34
Team,

How do I get multiple reports to export & save as a pdf then attach to a single email?

I'm using the code below, but I have no idea how to tailor it to handle more than 1 report.

Code:
Private Sub Email_Decorations_Click()
Dim strRep As String
Dim strDPath As String
Dim strFName As String
' What report to send
strRep = "Decorations Pending"
' Initial Path
strDPath = "Path name here"
' Filename
strFName = "Decorations.pdf"
' Output report as pdf
DoCmd.OutputTo acOutputReport, strRep, "PDFFormat(*.pdf)", strDPath & strFName, False, "", 0
' Send the report to whoever
Send_Dec (strDPath & strFName)
End Sub
Private Sub Send_Dec(strDoc As String)
Dim sTo As String
Dim sCC As String
Dim sBCC As String
Dim sSub As String
Dim sBody As String
Dim strCC As String
Dim OutApp As Object
Dim OutMail As Object
Dim varPress As Variant
    ' Get the email address from the current form control
    sTo = ""
 
    '  Set the subject
    sSub = "Evals & Decs"
    ' Build the body of the email
    sBody = "Team," & vbCrLf & vbCrLf
    sBody = sBody & "Here is the current decorations list for action."
 
    ' Create the email
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)
    sCC = ""
    sBCC = ""
 
 
    With OutMail
        .To = sTo
        .CC = sCC
        .BCC = sBCC
        .Subject = sSub
        .Body = sBody
        .attachments.Add (strDoc)
        .display
 
    End With
    Set OutMail = Nothing
    Set OutApp = Nothing
End Sub
 

Users who are viewing this thread

Top Bottom