Results 1 to 4 of 4
  1. #1
    mmart33 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    23

    Export html to body of email issue

    I have done tons of research on this and have actually made it work. Taking a report, exporting to html and the inserting it as the body of an email.

    Here is the issue, once textbox out of all them is not updating correctly PARTIALLY. I have a group header that shows the total for the whole group. The group total is correct for the first 2, then the next 2 are copies of the 2nd group total! Makes no sense because i can manualy do this and i do not get the odd copy and paste.

    Here are screenshots of what the report should show and what it does show in the email. I am aware the formatting does not get copied over to html and i can live with that.

    (Its the shaded grey number - the 3rd and 4th down are copies of the 2nd down)

    Click image for larger version. 

Name:	email and report data issue.jpg 
Views:	15 
Size:	96.0 KB 
ID:	11251

    The code is:

    Sub exporttohtml()


    Dim strLine, strHTML As String

    Dim OL As Outlook.Application
    Dim MyItem As Outlook.MailItem

    Set OL = New Outlook.Application
    Set MyItem = Outlook.Application.CreateItem(olMailItem)

    With MyItem
    .To = "xxxxx@xxxx.com"
    .Subject = "EOD and Access are completed for: " & Date
    End With
    Dim stDocName As String
    Dim stLinkCriteria As String
    DoCmd.OutputTo acOutputReport, "Daily Production Report", acFormatHTML, "P:\myreport.html"

    Open "P:\myreport.html" For Input As 1




    Do While Not EOF(1)
    Input #1, strLine
    strHTML = strHTML & strLine
    Loop
    Close 1

    If Left(OL.Version, 2) = "50" Then
    MyItem.BodyFormat = olFormatHTML
    End If
    MyItem.HTMLBody = strHTML
    MyItem.Display
    ' MyItem.Send

    End Sub

  2. #2
    mmart33 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    23
    Anyone have any ideas? This is driving me nuts because I dont understand it and it makes no sense!! lol

    Thanks in advance.

  3. #3
    mmart33 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    23
    Well I may have found something that is contributing to the issue.

    When I run the code above, you understand the issue I have. But when I use the Access export to option in the top menu, the html document doesnt show this.

    BUT when I decided to try a macro enabled export to html, the new html doc DOES replicate it! So now I know it is not an Outlook issue, but the way I am generating the html is causing it, the access button at the top does not cause this when it creates an html.

    Make sense?

  4. #4
    mmart33 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    23
    FYI for people having this issue...

    After a lot of work, and no replies here, I decided to just do a PDF export for Email. Some of the other sites and forums stated that HTML just cannot duplicate without a lot of formatting and coding and I do not know any HTML coding.

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

Similar Threads

  1. Report Sent as HTML Body - multiple pages
    By chris.williams in forum Reports
    Replies: 3
    Last Post: 09-15-2012, 07:18 PM
  2. HTML issue when using Word as email editor
    By dshillington in forum Programming
    Replies: 3
    Last Post: 02-14-2012, 03:28 PM
  3. Email report as body of email
    By chrish20202 in forum Programming
    Replies: 6
    Last Post: 01-15-2012, 07:23 PM
  4. HTML body in Access 2007
    By amangupts in forum Forms
    Replies: 4
    Last Post: 12-19-2011, 05:52 AM
  5. Export Contents of a Report into Email Body
    By Nosaj08 in forum Reports
    Replies: 4
    Last Post: 05-27-2009, 09: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