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:

Username:

Password:

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

How can I do that?!

Thanks!

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

<strong>Try this</strong>

And pls let me know if it worked.

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 = "myfriend@gmail.com  "
.Cc = "hisfriend@yahoo.com"
.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!

My pleasure .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.