try this one:
Sub oltask()
Dim olap As Outlook.Application
Dim oltask As Outlook.TaskItem
On Error Resume Next
' check if Outlook is running
Set olap = GetObject("outlook.application")
If Err <> 0 Then
'if not running, start it
Set olap = CreateObject("outlook.application")
End If
'set a new task
Set oltask = olap.CreateItem(olTaskItem)
With oltask
.Subject = "Christmas Dinner"
.DueDate = "12/25/01"
.StartDate = "12/25/01"
.ReminderSet = "12/25/01"
.ReminderTime = "18:00:00"
.Display ' if you want to display it
End With
Set olap = Nothing
Set oltask = Nothing
End Sub
Note: As you are using earlybinding you'll need
to reference the Outlook Object library
Just add this code to do it.
Sub MakeLibrary_outlook()
ThisWorkbook.VBProject.References.AddFromGuid _
"{00062FFF-0000-0000-C000-000000000046}", 9, 0
End Sub
Assuming Outlook 2000!
HTH
Ivan 'set a new task Set oltask = olap.CreateItem(olTaskItem) With oltask .Subject = "Christmas Dinner" .DueDate = "12/25/01" .StartDate = "12/25/01" .ReminderSet = "12/25/01" .ReminderTime = "18:00:00" .Display ' if you want to display it End With Set olap = Nothing Set oltask = Nothing