Create new MailItem from within an AppointmentItem

S

Steve

Hi all,

I'm trying to create a new MailItem from within an AppointmentItem but for
some reason, the code I'm using (see below) is creating a new blank
AppointmentItem instead. Can anyone offer any insight?

Dim olApp
Dim objMail
Set olApp = CreateObject("Outlook.Application")
Set objMail = olApp.CreateItem(olMailItem)

With objMail
.To = "[email protected]"
.CC = "[email protected]"
.Subject = "Whatever"
.Body = "Hello"
.Attachments.Add "c:\boot.ini"
.Display
End With
 
M

Mike Walker [MVP]

Hi Steve

Looking at your code sample you are trying to create a mail item from the
Application object which is fine, not AppointmentItem, have you referenced
the type library for the correct values for the enumeration of olMailItem.

What language are you developing in ?

Mike Walker MVP
Visual Developer VSTO
 
S

Steve

I'm using VBScript from within the AppointmentItem object, ie. open
appointment, click Design this Form, then click Tools, View Code. Initially
I tried using Parent.CreateItem(olMailItem), but that did the same thing
(creates a new blank appointment in my calendar).
 
Top