Results 1 to 2 of 2
  1. #1
    Mick99 is offline Advanced Beginner
    Windows 7 32bit Access 2013
    Join Date
    Jul 2015
    Posts
    58

    Formatting Issue Email Body Text


    Hi All, I have an issue where I need to retain the formatting of a generated HTML file into the body of an Outlook email. So far I have been able to get the detail into the body but it is not duplicating the format100% from the HTML file. The attached screen shot displays the differance between the two, the HTML view is the first one with the Email body text being the second. If I am unable to format this detail is there any other way to pull this info into the body of an email and allow me to format it. It is not my ideal way but it's what I have been requested to do. Any help would be greatly apprectaed.

    Cheers Mick

    Click image for larger version. 

Name:	Format Issue.JPG 
Views:	10 
Size:	68.8 KB 
ID:	21970

  2. #2
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Only on one project have I ever had to work around such a difference, but the message construct was much simpler than yours (no tables). In your case, I'm wondering what you'd get if you used a template (probably only Outlook templates can be used with Access) and/or mail merge.
    Anyway, in case it helps, I created the email "body" in sections in an Access function, inserting the recordset values as I went. Then it was all strung together in a final string and passed to the message via CDO. The caveat is that you have to be able to write HTML (ignoring the fact that stylesheets are preferred today). For example,
    svHead = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN' 'http://www.w3.org/TR/html4/strict.dtd'>" & vbCrLf (I found that without a doc type, font face was uncontrollable).
    svHead = svHead & "<HTML><HEAD><BODY><Font Face = 'Arial' Size='2'" & vbCrLf
    svTable = (set up your table) = "<Table><TR><TD> & rset.Fields(0)</TD></TR>" here's how you plunk in the values, mixed with other text if necessary.
    ETC.
    svEndHead = "</FONT></TABLE></BODY></HEAD></HTML>
    svEmlBody = svHead & svTable & svTableEnd & svHeadEnd & etc.


    Pretty daunting, no doubt. That's why you might want to find some code that uses an .oft. Your issue is probably the email defaults for an inserted table (such as padding). I bet somebody has a better way, but you did say "any help..."!

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

Similar Threads

  1. Replies: 1
    Last Post: 05-06-2014, 09:14 PM
  2. Replies: 3
    Last Post: 03-25-2013, 11:01 PM
  3. Export html to body of email issue
    By mmart33 in forum Reports
    Replies: 3
    Last Post: 02-28-2013, 03:16 PM
  4. FORMATTING Outlook Email in BODY of Access code
    By taimysho0 in forum Programming
    Replies: 7
    Last Post: 11-28-2011, 11:04 AM
  5. update database using email body text
    By ravindramn in forum Import/Export Data
    Replies: 0
    Last Post: 05-19-2011, 06:34 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