Results 1 to 4 of 4
  1. #1
    cdscivic is offline Resident Troll
    Windows XP Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    52

    Sending Report In Email Body

    SO, trying to send a report that I have in the actual body of the email. So far I have gotten the below code to generate an email but its all text and none of the formatting on the report. The report has a repeating "certificate" look to it, with 2 text boxes, a rectangle border and 2 linked pictures. Here is the code I am using, whaaaaaat did I do wrong?

    Code:
    Const ForReading = 1, ForWriting = 2, ForAppending = 3
    Dim fs, f
    Dim RTFBody, strTo
    Dim MyApp As New Outlook.Application
    Dim MyItem As Outlook.MailItem
    DoCmd.OutputTo acOutputReport, "rpt_ReportName", acFormatRTF, "rpt_ReportName.Rtf"
    'DoCmd.OutputTo acOutputQuery, "Query1", acFormatHTML, "Query1.htm"
    Set fs = CreateObject("Scripting.FileSystemObject")
    'Set f = fs.OpenTextFile("Query1.htm", ForReading)
    Set f = fs.OpenTextFile("rpt_ReportName.rtf", ForReading)
    RTFBody = f.ReadAll
    f.Close
    Set MyItem = MyApp.CreateItem(olMailItem)
    With MyItem
       .To = "Email@SomeEmail.com"
       .Subject = "Email Subject"
       '.Body = RTFBody
       .HTMLBody = RTFBody
    End With
    MyItem.Display


  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    Reports can be put in an email as attachment with ZERO code.
    docmd.SendObject

    users just dbl-click the attachment. Are you saying users dont have time to dbl-click?

  3. #3
    cdscivic is offline Resident Troll
    Windows XP Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    52
    Its for senior leaders, and the preference is that they are able to see it on the mobile application where attachments are not able to be viewed.

  4. #4
    cdscivic is offline Resident Troll
    Windows XP Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    52
    Update managed to convince them to accept an attachment.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 05-18-2015, 11:24 AM
  2. Sending Reports with email body having HTML
    By CeVaEs_64 in forum Access
    Replies: 28
    Last Post: 11-26-2014, 12:13 PM
  3. Replies: 1
    Last Post: 05-06-2014, 09:14 PM
  4. Replies: 1
    Last Post: 02-21-2012, 09:09 AM
  5. sending data into an email body - outlook
    By webisti in forum Access
    Replies: 6
    Last Post: 02-15-2012, 07:05 AM

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