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 = "(e-mail address removed)"
.CC = "(e-mail address removed)"
.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).
 

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