Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 10-18-2016, 05:38 AM
mlewis mlewis is offline .RTFBody property for a mail item is returning error Windows 7 64bit .RTFBody property for a mail item is returning error Office 2010 64bit
Novice
.RTFBody property for a mail item is returning error
 
Join Date: Jun 2014
Posts: 5
mlewis is on a distinguished road
Default .RTFBody property for a mail item is returning error

Hi,



I currently have a macro that creates personalised Emails i.e. Dear John, and then sends them out to a recipient list which it reads from a CSV file (it does other stuff as well but this is the lead into my problem). I want the Email body to come up in a specific format with a company logo, I have created the Email body with word and saved it as both HTML and RTF format, the HTML format does not display correctly as all of the logo's etc are saved as separate files on my PC and are not sent with the mail so I thought I would try it with RTF as all of the data is saved in a single file.

I have created the below macro to try and test just sending the RTF but it comes back with "Run-time error Method 'RTFBody of object _MailItem' failed". I have tried converting it but the array it is stored in is already a string so it should be the right type. Any ideas?

Code:
Sub RTF_email()

    Dim EmailHTMLFile As Integer
    Dim EmailHTMLFilePath As String
    Dim newFileContents As String
    Dim OutApp As Object
    Dim OutMail As Object


    EmailHTMLFilePath = "D:\Stuff\Email template.rtf"
    EmailHTMLFile = FreeFile()
    Open EmailHTMLFilePath For Input As #EmailHTMLFile

    'Reading the Email contents into an array which e are going to use and manipulate from here
    newFileContents = Input$(LOF(EmailHTMLFile), #EmailHTMLFile)
    Close #EmailHTMLFile


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

       ' Change the mail address and subject in the macro before you run this procedure.
       'On Error Resume Next
       With OutMail
        .to = "mlw@sierrawireless.com"
        .CC = ""
        .BCC = ""
        .Subject = "Test Email"
        .BodyFormat = 3
        .RTFBody = newFileContents
        
        .Display
       End With
        
End Sub
Regards

Matt
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
.RTFBody property for a mail item is returning error Copying data related to one item to worksheet with many instances of the same item nmp13 Excel 3 02-06-2016 02:13 AM
.RTFBody property for a mail item is returning error COUNTIFS returning Value Error ubns Excel 1 04-16-2015 02:00 PM
Returning a specific value when item is selected from a drop-down list J Press Excel 4 09-10-2012 06:12 AM
oulook 2003 error - this item cannot be displayed in the regading pane. GoneFusion Outlook 1 09-22-2010 09:45 AM
.RTFBody property for a mail item is returning error MYOB and "Item.Send error" Outlook message peter_lambros Outlook 1 12-06-2008 08:24 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:37 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft