dbTalk Databases Forums  

How to send Leban's RTF2 Rich text control contents into an Outlookemail body?

comp.databases.ms-access comp.databases.ms-access


Discuss How to send Leban's RTF2 Rich text control contents into an Outlookemail body? in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Bob Alston
 
Posts: n/a

Default How to send Leban's RTF2 Rich text control contents into an Outlookemail body? - 12-09-2010 , 04:30 PM






I am using Legan's RTF2 control. I am trying to send the RTF text via
an Outlook email. No problem sending normal, plain text.

Anyone know how to do this?

I saw this posting but don't understand it.

http://support.microsoft.com/?kbid=172038


Bob

Reply With Quote
  #2  
Old   
Jon Lewis
 
Posts: n/a

Default Re: How to send Leban's RTF2 Rich text control contents into an Outlook email body? - 12-16-2010 , 04:09 AM






Hi Bob

All you have to do is grab the RTF/HTML into a String variable then append
this string to the HTMLBody property of the message using Automation and of
course you need to set a reference to the Outlook object library:

My routine is complex and involves alot of other stuff irrelevant to your
question but the following extract I hope illustrates the method (plenty of
Googleable stuff on this is available):

Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim colOutlookAttachs As Outlook.Attachments
Dim objOutlookAttach As Outlook.Attachment
Dim objOutlookNameSpace As Outlook.NameSpace
Dim objOutlookDestFolder As MAPIFolder

' create new Outlook MailItem
On Error Resume Next
Set objOutlook = GetObject("Outlook.Application")
If Err Then
Set objOutlook = CreateObject("Outlook.Application")
End If
On Error GoTo Err_Handler
Set objOutlookNameSpace = objOutlook.GetNamespace("MAPI")
Set objOutlookDestFolder =
objOutlookNameSpace.GetDefaultFolder(olFolderOutbo x)

'strBody is the string containing the HTML/RTF

objOutlookMsg.HTMLBody = objOutlookMsg.HTMLBody & strBody (this appends,
you may get away with objOutlookMsg.HTMLBody = strBody)


HTH


Jon




"Bob Alston" <bobalston9 (AT) yahoo (DOT) com> wrote

Quote:
I am using Legan's RTF2 control. I am trying to send the RTF text via an
Outlook email. No problem sending normal, plain text.

Anyone know how to do this?

I saw this posting but don't understand it.

http://support.microsoft.com/?kbid=172038


Bob

Reply With Quote
  #3  
Old   
Bob Alston
 
Posts: n/a

Default Re: How to send Leban's RTF2 Rich text control contents into an Outlookemail body? - 12-16-2010 , 11:32 AM



On 12/16/2010 4:09 AM, Jon Lewis wrote:
Quote:
Hi Bob

All you have to do is grab the RTF/HTML into a String variable then append
this string to the HTMLBody property of the message using Automation and of
course you need to set a reference to the Outlook object library:

My routine is complex and involves alot of other stuff irrelevant to your
question but the following extract I hope illustrates the method (plenty of
Googleable stuff on this is available):

Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim colOutlookAttachs As Outlook.Attachments
Dim objOutlookAttach As Outlook.Attachment
Dim objOutlookNameSpace As Outlook.NameSpace
Dim objOutlookDestFolder As MAPIFolder

' create new Outlook MailItem
On Error Resume Next
Set objOutlook = GetObject("Outlook.Application")
If Err Then
Set objOutlook = CreateObject("Outlook.Application")
End If
On Error GoTo Err_Handler
Set objOutlookNameSpace = objOutlook.GetNamespace("MAPI")
Set objOutlookDestFolder =
objOutlookNameSpace.GetDefaultFolder(olFolderOutbo x)

'strBody is the string containing the HTML/RTF

objOutlookMsg.HTMLBody = objOutlookMsg.HTMLBody& strBody (this appends,
you may get away with objOutlookMsg.HTMLBody = strBody)


HTH


Jon




"Bob Alston"<bobalston9 (AT) yahoo (DOT) com> wrote in message
news:gMcMo.14665$IO3.1158 (AT) newsfe05 (DOT) iad...
I am using Legan's RTF2 control. I am trying to send the RTF text via an
Outlook email. No problem sending normal, plain text.

Anyone know how to do this?

I saw this posting but don't understand it.

http://support.microsoft.com/?kbid=172038


Bob


Jon

thank you so much. I will try your technique.

Believe me I googled a lot and found stuff but nothing like what you
provided. If I missed some excellent material on point, I would be
pleased if you could refer me to that stuff.

Bob

Reply With Quote
  #4  
Old   
Bob Alston
 
Posts: n/a

Default Re: How to send Leban's RTF2 Rich text control contents into an Outlookemail body? - 12-16-2010 , 02:17 PM



On 12/9/2010 4:30 PM, Bob Alston wrote:
Quote:
I am using Legan's RTF2 control. I am trying to send the RTF text via an
Outlook email. No problem sending normal, plain text.

Anyone know how to do this?

I saw this posting but don't understand it.

http://support.microsoft.com/?kbid=172038


Bob
Unfortunately I cannot get it to work. What happens is the text
containing the formatting characters is displayed in the email body:




My code:

Sub SendEmailTest()


Dim olookApp As Outlook.Application
Dim olookMsg As Outlook.MailItem
Dim olookRecipient As Outlook.recipient
Dim olookAttach As Outlook.Attachment

' create the Outlook session.
Set olookApp = CreateObject("Outlook.Application")

' create the message.
Set olookMsg = olookApp.CreateItem(olMailItem)

With olookMsg
' add the To recipient(s) to the message.
Set olookRecipient =
..Recipients.Add(Forms!frm_Mass_Email_Specificatio ns!TestEmailAddress)
olookRecipient.Type = olTo

' set the Subject, Body, and Importance of the message.
.subject = Forms!frm_Mass_Email_Specifications!Emailsubject
.bodyformat = olFormatHTML

'''''''.Body = Forms!frm_mass_email_Specifications!RTFField
.htmlbody = .htmlbody + Forms!frm_Mass_Email_Specifications!txtcusRTF

.send
wend
end sub

Reply With Quote
  #5  
Old   
Jon Lewis
 
Posts: n/a

Default Re: How to send Leban's RTF2 Rich text control contents into an Outlook email body? - 12-17-2010 , 12:14 PM



Not sure what's going on then.

Try hard coding some HTML to see if it works then

e.g.

..HTMLBody = "<HTML><H2>The body of this message will appear in
HTML.</H2><BODY>Type the message text here. </BODY></HTML>"

Also (by the way) starting with Office 2007 Outlook only supports a limited
HTML command set which is worth knowing when you are creating html eShots.
Google "HTML e-Mail Rendering in Outlook 2007" for details

Jon


"Bob Alston" <bobalston9 (AT) yahoo (DOT) com> wrote

Quote:
On 12/9/2010 4:30 PM, Bob Alston wrote:
I am using Legan's RTF2 control. I am trying to send the RTF text via an
Outlook email. No problem sending normal, plain text.

Anyone know how to do this?

I saw this posting but don't understand it.

http://support.microsoft.com/?kbid=172038


Bob
Unfortunately I cannot get it to work. What happens is the text
containing the formatting characters is displayed in the email body:




My code:

Sub SendEmailTest()


Dim olookApp As Outlook.Application
Dim olookMsg As Outlook.MailItem
Dim olookRecipient As Outlook.recipient
Dim olookAttach As Outlook.Attachment

' create the Outlook session.
Set olookApp = CreateObject("Outlook.Application")

' create the message.
Set olookMsg = olookApp.CreateItem(olMailItem)

With olookMsg
' add the To recipient(s) to the message.
Set olookRecipient =
.Recipients.Add(Forms!frm_Mass_Email_Specification s!TestEmailAddress)
olookRecipient.Type = olTo

' set the Subject, Body, and Importance of the message.
.subject = Forms!frm_Mass_Email_Specifications!Emailsubject
.bodyformat = olFormatHTML

'''''''.Body = Forms!frm_mass_email_Specifications!RTFField
.htmlbody = .htmlbody +
Forms!frm_Mass_Email_Specifications!txtcusRTF

.send
wend
end sub

Reply With Quote
  #6  
Old   
Bob Alston
 
Posts: n/a

Default Re: How to send Leban's RTF2 Rich text control contents into an Outlookemail body? - 12-17-2010 , 01:03 PM



On 12/17/2010 12:14 PM, Jon Lewis wrote:
Quote:
Not sure what's going on then.

Try hard coding some HTML to see if it works then

e.g.

.HTMLBody = "<HTML><H2>The body of this message will appear in
HTML.</H2><BODY>Type the message text here.</BODY></HTML>"

Also (by the way) starting with Office 2007 Outlook only supports a limited
HTML command set which is worth knowing when you are creating html eShots.
Google "HTML e-Mail Rendering in Outlook 2007" for details

Jon


"Bob Alston"<bobalston9 (AT) yahoo (DOT) com> wrote in message
news:ItuOo.12714$Zf2.8489 (AT) newsfe17 (DOT) iad...
On 12/9/2010 4:30 PM, Bob Alston wrote:
I am using Legan's RTF2 control. I am trying to send the RTF text via an
Outlook email. No problem sending normal, plain text.

Anyone know how to do this?

I saw this posting but don't understand it.

http://support.microsoft.com/?kbid=172038


Bob
Unfortunately I cannot get it to work. What happens is the text
containing the formatting characters is displayed in the email body:




My code:

Sub SendEmailTest()


Dim olookApp As Outlook.Application
Dim olookMsg As Outlook.MailItem
Dim olookRecipient As Outlook.recipient
Dim olookAttach As Outlook.Attachment

' create the Outlook session.
Set olookApp = CreateObject("Outlook.Application")

' create the message.
Set olookMsg = olookApp.CreateItem(olMailItem)

With olookMsg
' add the To recipient(s) to the message.
Set olookRecipient =
.Recipients.Add(Forms!frm_Mass_Email_Specification s!TestEmailAddress)
olookRecipient.Type = olTo

' set the Subject, Body, and Importance of the message.
.subject = Forms!frm_Mass_Email_Specifications!Emailsubject
.bodyformat = olFormatHTML

'''''''.Body = Forms!frm_mass_email_Specifications!RTFField
.htmlbody = .htmlbody +
Forms!frm_Mass_Email_Specifications!txtcusRTF

.send
wend
end sub


I now understand the difference from RTF formatting and HTML formatting.
Outlook and CDO supports HTML formatting. No way to get RTF
formatting into an Outlook email via VBA without $ third party software.

Bob

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.