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

    Email .HTMLBody code

    I never thought I would be needing to do this but here goes. I can create PDF's, DOCX's retaining the PDF formatting save them back to differant network locations and then retrieve and attach to emails that are genrated for differant areas, however I have been asked to scrap the attahcment and insert the content of the attachment directly into the body of the email. I have had a good browse around the net with no real approach. The code below simply gets the recepients email address adds the subject and then is looking for the .HTMLBody which simply comes through in the body as "O:\div\AKL\Resgroup\E - Reports\HTML Files\DRAFT TEST .html" '' "Please find your, Blagh" Any help would be greatly appreciated.


    .To = RScoloumdetail(2) ' Gets Email Address
    .CC = ""
    .BCC = ""
    .Subject = "TESTING - " 'Hi," & " " & RScoloumdetail(0) & " " & RScoloumdetail(1) & " " & "here is your Statement" & " ""Hi," & " " & RScoloumdetail(2)
    .HTMLBody = "O:\div\AKL\Resgroup\E - Reports\HTML Files\DRAFT TEST .html" '' "Please find your, Blagh"
    ' .Attachments.Add FilePath ' EmailFile & FileName ' Not required
    If Send = True Then


    .Save
    Else
    .Save
    End If


    Cheers Mick

  2. #2
    InsuranceGuy is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Aug 2015
    Location
    Colorado
    Posts
    126
    Since HTML is just a text file, you can read the file into a variable and then pass the string variable to .HTMLBody

    See: http://codevba.com/office/read_text_...g_variable.htm

    Cheers,


    Jeff

  3. #3
    Mick99 is offline Advanced Beginner
    Windows 7 32bit Access 2013
    Join Date
    Jul 2015
    Posts
    58
    Hi Jeff, I have been playing with this all day and have been able to get the text into the body but not with the formatting. After your help I now have the body plus the formatting. Cheers mate really appreciate it.


    Cheers Mick

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

Similar Threads

  1. Replies: 6
    Last Post: 07-24-2015, 01:26 PM
  2. Help with email code
    By sroot in forum Programming
    Replies: 11
    Last Post: 12-10-2014, 06:46 AM
  3. Replies: 6
    Last Post: 03-26-2014, 10:04 AM
  4. htmlbody editing
    By trevor40 in forum Programming
    Replies: 2
    Last Post: 02-13-2014, 04:38 PM
  5. Indenting Using htmlbody
    By graviz in forum Programming
    Replies: 1
    Last Post: 12-18-2009, 05:56 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