![]() |
#1
|
|||
|
|||
![]()
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 Matt |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
nmp13 | Excel | 3 | 02-06-2016 02:13 AM |
![]() |
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 |
![]() |
peter_lambros | Outlook | 1 | 12-06-2008 08:24 AM |