Discussion:
RichTextBox to Outlook Message Body
(too old to reply)
K
2010-01-12 15:41:58 UTC
Permalink
I am using Visual Basic 2005 and I am trying to put RichTextBox1
formated text into Outlook Message body. I got code (see below)

Dim OutApp As Object
Dim OutMail As Object

OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon()
OutMail = OutApp.CreateItem(0)

On Error Resume Next

With OutMail

.To = "***@yahoo.com"
'.CC = ""
'.BCC = ""
.Subject = "Testing"
.HtmlBody = ? 'need code here
.Display()
End With

On Error GoTo 0

OutMail = Nothing
OutApp = Nothing

I tried putting below line but I don’t get formated text in the
Message body
.HtmlBody = RichTextBox1.Text

when I changed above line with below I got all the formatting in
Message body but I also had extra things like strange code line on top
and funny characters in between the text
.HtmlBody = Clipboard.GetText(TextDataFormat.Html)

It will be greate if some friend can tell me the code with which I can
get formated text from the RichTextBox1 to Outlook 2007 Message body.
Michael Cole
2010-01-14 13:43:59 UTC
Permalink
[Followup to microsoft.public.dotnet.languages.vb]
I am using Visual Basic 2005...
Two points follow...

1. Your post was posted seperately to multiple newsgroups. This is referred
to
a "Multiposting", and is generally frowned upon. Usually, it is best to
post to only one newsgroup. However, if for some reason you do wish to post
to more than one, you should always crosspost, and never multipost.

Crossposting is addressing a single post to two or more newsgroups
simultaneously. This is done by entering the names of the newsgroups in the
Newsgroups input box of your newsreader. Normally the newsgroup names are
separated by a comma; some newsreaders will also accept a carriage return as
a delimiter.

Your question was answered in another group. Which one? See the problem?

Please don't multipost. Please refer to microsoft.public.netiquette for
further information.

2. For this question, you will need to ask in a .NET group.
Almost everybody here is using VB6 or earlier. While you may get a stray
answer to VB.NET questions here, you should ask them in newsgroups devoted
exclusively to .NET programming. Look for newsgroups with the word "dotnet"
in their name.

For the microsoft news server, try these newsgroups...

microsoft.public.dotnet.general
microsoft.public.dotnet.languages.vb

If your ISP doesn't carry them, use your NNTP client to connect directly to
news://msnews.microsoft.com
There are some others, but these should get you started.
--
Regards,

Michael Cole
Loading...