Populating an Outlook appointment with RTF text- followup

S

Simon Baker

This is something I have asked about before and have almost figured out.
Thanks to Sue Mosher's advice some months back, using Redemption has rendered
it possible using the code below, where objContact.rtfbody is populated from
a Rich Text control in Access.

However, I ideally want to pouplate it from a .rtf file, in this case
H:\RTF_Temp.rtf as shown below. Any ideas?

Thanks in advance


Simon

Dim objApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objFolder As Outlook.MAPIFolder
Dim objDummy As Outlook.MailItem
Dim objRecip As Outlook.Recipient
Dim objAppt As Outlook.AppointmentItem
Dim wrdRTF As Word.Document
Dim objContact As Object

strName = "Calendar, EQT_RES (Pharmaceuticals)"

Set wrdRTF = GetObject("H:\RTF_Temp.rtf")

Set objContact = CreateItem("Redemption.SafeMeetingItem")


Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objDummy = objApp.CreateItem(olMailItem)
Set objRecip = objDummy.Recipients.Add(strName)


objRecip.Resolve
Set objFolder = objNS.GetSharedDefaultFolder(objRecip, olFolderCalendar)

Set objAppt = objFolder.Items.Add

Set objContact = New Redemption.SafeAppointmentItem
objContact.Item = objAppt
With objContact
.Subject = "Test Appointment"
.Start = "01/07/2005"
.End = "01/07/2005"
.AllDayEvent = True
.rtfbody = ???????????
.Save

End With
 
S

Simon Baker

Perfect! Job done

Many thanks (again)

Simon

Sue Mosher said:
You should be able to use FileSystemObject methods to read the text from the .rtf file. See http://www.outlookcode.com/d/vbscript.htm#fso if you're not familiar with this scripting object.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top