![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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 |
#3
| |||
| |||
|
|
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 |
#4
| |||
| |||
|
|
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 |
#5
| |||
| |||
|
|
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 |
#6
| |||
| |||
|
|
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. |
![]() |
| Thread Tools | |
| Display Modes | |
| |