View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default User Defined not defind

With "Early Binding" to Outlook you need to "check" the reference to MS
Outlook in Tools - References. Alternatively you can switch to "Late
Binding" with the following changes to your code

Dim olApp As Object ' Outlook.Application
Dim olTsk As Object ' TaskItem

Set olApp = CreateObject("outlook.application") ' New Outlook.Application
'code
..Status = 1 ' olTaskInProgress
..Importance = 2 ' olImportanceHigh
'code

If there is any possibility of a user of your file having an older version
of Outlook than yours, use the Late Binding method.

Regards,
Peter T


"Looping through" wrote in
message ...
I have a question.

How do you define the following

Sub CreateTask()

Dim olApp As Outlook.Application
Dim olTsk As TaskItem

Set olApp = New Outlook.Application
Set olTsk = olApp.CreateItem(olTaskItem)

With olTsk
.Subject = "Update Web Site"
.Status = olTaskInProgress
.Importance = olImportanceHigh
.DueDate = DateValue("06/26/03")
.TotalWork = 40
.ActualWork = 20
.Save
End With

Set olTsk = Nothing
Set olApp = Nothing

End Sub

When I run this code I get an error stating "User-Definded type not

defined"

Pete