View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Torbjörn Steijer Torbjörn Steijer is offline
external usenet poster
 
Posts: 6
Default Creating e-mail in Excel

Thanks a lot! It works just the way I want it. One other prblem to solve,
how do I get the font to be Arial when it is passed into the mailbody? In
the textbox it is Arial but Times in the mailbody. Minor problem but it
doesn't look as good as I wish!

Any good ideas?

TIA

Torbjörn
"Dick Kusleika" skrev i
meddelandet ...
Torbjorn

Try replacing Chr(10) with "<BR" to insert line breaks in the HTML.

Here's
an example:

Private Sub CommandButton1_Click()

Dim ol As Outlook.Application
Dim mi As Outlook.MailItem
Dim stHTML As String

Set ol = New Outlook.Application
Set mi = ol.CreateItem(olMailItem)

stHTML = "<HTML<BODY"
stHTML = stHTML & Me.TextBox1.Text
stHTML = Replace(stHTML, Chr(10), "<BR")


mi.HTMLBody = stHTML
mi.Display

End Sub

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"Torbjörn Steijer" wrote in message
...
Hello,

I have an application where I create an e-mail in Excel based on what

team
members to play in different hockey games.

The body in Outlook is created as a HTML-body.

To enhance the application I would like to add text to the body. I have

a
userform with a textbox where I write the message, which works just fine

but
with one problem though. The linefeed I have in the textbox are lost

when
it
is passed in to the e-mailbody. Is there any way to get keep the format

from
the textbox in the e-mail?

Best regards,

Torbjörn