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 = "[email protected]"
            '.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

Reply via email to