Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2014
    Posts
    3

    Unanswered: Report to Email - PDF

    Hello All,

    I have 3 reports that I generate, right now I have to save them as a pdf then email them, there is a way to combine those 3 reports and send them via email all 3 at once?

  2. #2
    Join Date
    Sep 2014
    Posts
    37
    I would probably generate the three pdfs separately, then create a mail object and attach them. I found this code here for the creation of an email with attachments. This is not my code and make no claims to it, but thought it might help.

    -cheers


    Code:
    Private Sub email_exp1_Click()
     
    Dim MyDb As DAO.Database
    Dim rsEmail As DAO.Recordset
    Dim qdf As DAO.QueryDef
    Dim prm As DAO.Parameter
    Dim strEmail As String
    Dim strMsg As String
    Dim oLook As Object
    Dim oMail As Object
    Set MyDb = CurrentDb
    Set qdf = MyDb.QueryDefs("qryexp_may11")
    For Each prm In qdf.Parameters
        prm.Value = Eval(prm.Name)
    Next
    Set rsEmail = qdf.OpenRecordset()
    Set oLook = CreateObject("Outlook.Application")
    With rsEmail
            .MoveFirst
            Do Until rsEmail.EOF
            myRecipient = .Fields(0)
                If IsNull(myRecipient) = False Then
                    Set oLook = CreateObject("Outlook.Application")
                    Set oMail = oLook.createitem(0)
                    With oMail
                        .to = myRecipient
                        .body = "See attached"
                        .Subject = "Test Email"
                        .Attachments.Add ("\\mynetwork\mynetworkfolder\test.doc")
                        .Send
                    End With
                End If
                        .MoveNext
            Loop
    End With
    Set oMail = Nothing
    Set oLook = Nothing
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •