How to format just one line in VBA-generated email?

valeryk2000

Registered User.
Local time
Today, 02:19
Joined
Apr 7, 2009
Messages
157
Our Access 2003 application generates emails by using VBA. The sending part of the code looks like that:

Set mMail = appOutlook.CreateItem(olMailItem)
With mMail
.To = strAddress
.CC = strCC
.Subject = strSubject
.Body = strBody
.Send
End With


Our user wants one line in the email to be presented in larger font:
========
[FONT=&quot]Disposition of case (based on screening by the Physician Reviewer):[/FONT]
[FONT=&quot]- Refer to Nursing Peer Review Committee[/FONT]
[FONT=&quot]- Refer to Hospital Administration: Quality/Regulatory[/FONT]
[FONT=&quot]Please complete case follow-up by 2/9/2016[/FONT]
[FONT=&quot]Physician Reviewer: name
================
I googled it and tried to apply this code (just for one paragraph):
[/FONT]
strBody=strBody & "<p style='font-family:calibri;font-size:14'>" & "
Please complete case follow-up by 2/9/2016" & "</p>"plus changed the sending part of code to (see above)

With mMail
.To = strAddress
.CC = strCC
.Subject = strSubject
.BodyFormat = olFormatHTML
.HTMLBody = strBody

.Send
End With

It does not work. Any suggestions? Thanks
Val
 
untested:

strBody = strBody & <div><font face="Calibri" size=14>" & "Please complete case follow-up by 2/9/2016" & "</font></div>"
 
You will have to create the whole body text with HTML coding around it - not just the bit you want in bold.
 
Minty - just this line - properties in red tells Outlook that it is HTML format.
With mMail
.To = strAddress
.CC = strCC
.Subject = strSubject
.BodyFormat = olFormatHTML
.HTMLBody = strBody

.Send
End With

arnelgp - good suggestion, I did not try it yet because I get away with my original code - it worked on the level of paragraph (<p>). Naturally I had to include in the string strBody <br> tags (otherwise all was in one line - vbCrLf does not work here ;-)
My users are happy and
Thank both of you very much!
Val
 
Yes - but the rest of your body text (Below) has NO htlm tags around it so it doesn't handle it correctly.

Disposition of case (based on screening by the Physician Reviewer):
- Refer to Nursing Peer Review Committee
- Refer to Hospital Administration: Quality/Regulatory
 
Not exactly. I added <br> tags to separate lines into strBody and <i> for signature. It looks perfect.
Thank you again
 

Users who are viewing this thread

Back
Top Bottom