Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formating Font in Automated Email 1

Status
Not open for further replies.

T8JGT

IS-IT--Management
Feb 2, 2005
19
0
0
GB
Hi

I have some VBA which generates an email, i need it to be in a particular fond and certain words made bold. What do i need to do to acheive this (code given below)


Private Sub Command18_Click()
Dim strEmail, strBody As String
Dim objOutlook As Object
Dim objEmail As Object

Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)

strEmail = txtEmail

strBody = ITSQFDocumentName & " received from " & ProjectServiceDesigner & _
": '" & ProjectName & "'- PAR " & ProjectPAR & Chr(13) & Chr(13)
strBody = strBody & "Go Live - " & ProjectLiveDate & Chr(13)
strBody = strBody & ProjectSummary & Chr(13)
strBody = strBody & ITSQFServRecommendation & Chr(13)
strBody = strBody & ITSQFQualityGate & Chr(13)
strBody = strBody & ITSQFList & Chr(13)
strBody = strBody & ITSQFDocumentAddress & Chr(13)

'***creates and sends email
With objEmail
.To = "address@gmail.com"
.Subject = "ITSQF Submission"
.Body = strBody
.Send
End With


Set objEmail = Nothing


End Sub
 
Hi
The piece below is from an old MSDN library. I found I did not need most of the stuff, just the .HTMLBody (rather than .Body) and suitable HTML coding (<B></B> etc)

Code:
CDO Example Using MHTML
The sample code below shows the HTML text and the graphic image that is added to the message. When the message is viewed, the graphic is displayed inline.

HTML = "<!DOCTYPE HTML PUBLIC ""-//IETF//DTD HTML//EN"">" & NL
HTML = HTML & "<html>"
HTML = HTML & "<head>"
HTML = HTML & "<meta http-equiv=""Content-Type"""
HTML = HTML & "content=""text/html; charset=iso-8859-1"">"
HTML = HTML & "<meta name=""GENERATOR"" content=""Microsoft FrontPage 2.0"">"
HTML = HTML & "<title>Exchange CDO Example</title>"
HTML = HTML & "</head>"
HTML = HTML & "<body bgcolor=""#FFFFFF"">"
HTML = HTML & "<p><font size=""6"" face=""Arial Black""><strong>Exchange CDO "
HTML = HTML & "Sample<img src=CDO.gif>"
HTML = HTML & "</strong></font></p>"
HTML = HTML & "<p>CDO for NTS allows an easy way to send mail."
HTML = HTML & "This example shows how the content can be an HTML page"
HTML = HTML & "which allows you to send rich text and inline graphics.</p>"
HTML = HTML & "</body>"
HTML = HTML & "</html>"
MyMail.HTMLBody = HTML
myMail.AddRelatedAttachment "D:\[URL unfurl="true"]wwwroot\CDO.gif",[/URL] "CDO.gif"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top