Page 1 of 3 123 LastLast
Results 1 to 15 of 44
  1. #1
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496

    Outlook batch email PDF

    I've been given the task of making a button that batch emails bookings of all the schools on the database that have booked with each their own PDF (print report already made).

    So I have the query and report made - before I head into trying to make this happen I thought I'd ask for the best method.

    The query includes the emails
    The schools can't have a pdf showing other schools details (I assume each report gets individually made into a pdf rather than a combined pdf)


    Batch emailed via Outlook I am guessing
    Guessing this is a task that takes time so the person walks away and lets outlook do it's work if there are 700 schools to email (although working in the background would be nice)

    Any advice much appreciated.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    You will have to use VBA. Common topic. Search forum and Google. Here is a start:

    https://www.accessforums.net/import-...ook-18221.html

    https://www.accessforums.net/access/...ect-17713.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Thanks I will have a read through these links

  4. #4
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by Ruegen View Post
    Thanks I will have a read through these links
    I'm up to a stage of sending off emails but one last thing I am confused about

    with docmd.sendobject I have the option of sending a report

    how do I use that using the outlook object library vba? (as a PDF)

  5. #5
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Use docmd.openreport then send object then docmd.close acreport

    Or something

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    SendObject doesn't need the Outlook library because not manipulating an Outlook object.

    If email is a simple message and don't have to do other attachments to email, SendObject might be adequate.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    ??

    But how do I ensure the email I send off using outlook library gets an attached PDF like I would using sendobject?

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    That requires first saving the report as an external PDF file (OutputTo method) and then attaching that file to the Outlook email object.

    I think Access can save as PDF without having any Adobe software installed.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by June7 View Post
    That requires first saving the report as an external PDF file (OutputTo method) and then attaching that file to the Outlook email object.

    I think Access can save as PDF without having any Adobe software installed.
    oh....
    Click image for larger version. 

Name:	images.jpg 
Views:	19 
Size:	8.2 KB 
ID:	14723

  10. #10
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    I think I will use this

    http://stackoverflow.com/questions/2...of-values-from

    What do you think?

  11. #11
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    That should save the PDF file.

    Then follow with the email code that attaches the file.

    Then code can even delete the PDF file.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  12. #12
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Maybe something like

    Code:
            DoCmd.OpenReport "rptName", acViewPreview, , strCriteria, acHidden
            DoCmd.SendObject acSendReport, "rptName", acFormatPDF, strEmail, , , "Subject Line", "Body of Email", True
            DoCmd.Close acReport, "rptName"

  13. #13
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    I was typing from my phone earlier....

  14. #14
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by ItsMe View Post
    Maybe something like

    Code:
            DoCmd.OpenReport "rptName", acViewPreview, , strCriteria, acHidden
            DoCmd.SendObject acSendReport, "rptName", acFormatPDF, strEmail, , , "Subject Line", "Body of Email", True
            DoCmd.Close acReport, "rptName"
    Problem is I'm using outlook object library

    i.e.
    Code:
    'open Outlook, attach zip folder or file, send e-mail
    With MailOutLook
        .BodyFormat = olFormatHTML
        .To = "email@email.com.au"
        ''.cc = ""
        ''.bcc = ""
        .Subject = msubject & " " & emailofsc
        .HTMLBody = messagebody  
    
    
        .DeleteAfterSubmit = False 'This would let Outlook send the note without storing it in your sent bin
        .ReadReceiptRequested = True
        .send

  15. #15
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Why do you need to use that method?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Page 1 of 3 123 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Automated Email using Outlook
    By imran688 in forum Programming
    Replies: 25
    Last Post: 11-12-2012, 03:02 AM
  2. Email and Outlook
    By Douglas Post in forum Programming
    Replies: 1
    Last Post: 02-13-2012, 02:57 PM
  3. email with outlook.application
    By JJCHCK in forum Access
    Replies: 5
    Last Post: 08-25-2011, 06:19 AM
  4. Passing Email Address Into Outlook
    By cg1465 in forum Access
    Replies: 1
    Last Post: 10-01-2010, 07:59 AM
  5. Exporting Outlook email addresses
    By noidea in forum Import/Export Data
    Replies: 0
    Last Post: 08-01-2009, 01:48 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums