Outlook And HTMLBody

MattS

Crabby Cancerian.....
Local time
Today, 11:08
Joined
Jun 18, 2003
Messages
130
I want to include some fairly basic formatting (bold and underlined text) within an e-mail. Having searched through various posts here, it seems I have to use the .HTMLBody property.

The problem with this it that you have to have some idea of HTML (which I don't!). If somebody could give me a lead in it would be much appreciated.

A basic example of what I want:

Query Details

Raised By: Fred Bloggs
Date Raised: 22/04/2003

Query Text

Blah Blah Blah Blah


Thanks,

Matt.
 
Well, for those that are interested the HTML for this turned out to be pretty straight forward:

<b> </b> Bold text
<u> </u> Underlined text
<br> Line break

The following code creates and displays an email like the example given above:

Code:
Public Sub sTestEmail()
Dim outApp As Outlook.Application ' An instance of Outlook
Dim outItem As Outlook.MailItem ' An e-mail
Dim strEMailRec As String ' E-Mail recipient
Dim strEMailTitle As String ' E-Mail title
Dim strEMailMsg As String ' E-Mail message text
    strEMailRec = "matthew saunders"
    strEMailTitle = "Test Message"
    strEMailMsg = "<b><u>Query Details</u></b><br><br>"
    strEMailMsg = strEMailMsg & "Raised By: Fred Bloggs<br>"
    strEMailMsg = strEMailMsg & "Date Raised: 22/04/2003<br><br>"
    strEMailMsg = strEMailMsg & "<b><u>Query Text</u></b><br><br>"
    strEMailMsg = strEMailMsg & "Blah Blah Blah Blah"
Set outApp = New Outlook.Application
Set outItem = outApp.CreateItem(olMailItem)
    With outItem
        .To = strEMailRec
        .Subject = strEMailTitle
        .HTMLBody = strEMailMsg
        .Display
    End With
Set outItem = Nothing
Set outApp = Nothing
End Sub

Thought I'd post it here for future reference.

Matt.
 
Thanks!!
 

Users who are viewing this thread

Back
Top Bottom