Create an Outlook Task

S

Steven

I want to set up a task through excel.
I get an error:
User defined type not defined on the objTask As Outlook.TaskItem
on the following.

Sub createTask()
Dim objTask As Outlook.TaskItem
Set objTask = OutApp.CreateItem(olTaskItem)
With objTask
.StartDate = "05/30/2008"
.DueDate = "05/31/2008"
.Subject = "Testing Task"
.Body = "Testing Task"
.Assign
.Recipients = "Employee Name"
.Send
End With
Set objTask = Nothing
End Sub


How do I correct this?

Thank you,

Steven
 
D

dan dungan

Hi Steven,

In the vbe under tools, is the reference set to Microsoft Outlook 9.0
Object Library?

Dan
 
D

dan dungan

Hi Steve,

When I tried the code sample

I had to dim ol and ns

so I did it like this:
Const olFolderTasks = 13

Dim ol As Application
Dim ns As NameSpace
Dim r As Integer
Dim x As Integer

Excel returned the compile error: Assignment to a constant not
permitted on

Set olFolder = ns.GetDefaultFolder(olFolderTasks)

Should I have done something differently?

Dan
 

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