Start New Discussion within our Software Development Community

Hi All,

I just tried to write a code which, upon clicking on a button should send an email with attachment. I succeded by using some of the posts here, but however I need to add some special effects in between...

In the body of the email, I need to Bold and change 2 lines to blue.
Like this:



OutLookMail.Body = "Username: " & TxtUsername.Text & vbCrLf & "" & vbCrLf & "Password: " & TxtPassword.Text

How can I do that?!


Is it like we can only make "plain text" body? I tried using the and <b> tags... it's not working!

try to use this

Dim objOutlook As Object
Dim objOutlookMsg As Object
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(0)
With objOutlookMsg
.To = "  "
.Cc = ""
.Subject = "Hello Friends (one more time)..."
.Body = "This is the body of message"
.HTMLBody = "HTML version of message"
.Attachments.Add ("c:\myFileToSend.txt")
.Send      'send the mail
End With
Set objOutlookMsg = Nothing
Set objOutlook = Nothing

Thanks a lot... That worked.

Cometburn - Your suggestion did work, but after using hte previous code only! I didn't use the HTML body and that's why <b> and tags didn't work. Thanks a lot again! Have a great day!

This article has been dead for over six months. Start a new discussion instead.