View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
scott56hannah scott56hannah is offline
external usenet poster
 
Posts: 51
Default Searching for an Outlook Task from Excel

I got some help regarding creating an outlook task from Excel....that worked...

I would now like to be able to search for an existing outlook task on a
users PC and then if it exists update it...

I have the following code so far....Find statement does not seem to be
returning values but the search values are valid for entries in the Outlook
tasks....

Any help appreciated....

Sub CreateTask()

Dim olApp As Outlook.Application
Dim olTsk As TaskItem

Dim olFoundTask As TaskItem
Dim olTasks As Outlook.MAPIFolder
Dim olNameSpace As Outlook.Namespace


Set olApp = CreateObject("Outlook.Application")
Set olNameSpace = olApp.GetNamespace("MAPI")
Set olTasks = olNameSpace.GetDefaultFolder(olFolderTasks)
Set olFoundTask = olTasks.Items.Find("[Subject] = 'Jeff'")


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

With olTsk
.Subject = Range("A6")
.Status = olTaskInProgress
.Importance = olImportanceHigh
.DueDate = Range("B6")
.TotalWork = 40
.ActualWork = 20
.CardData = "New" & Range("b6")
.Save
End With

Set olTsk = Nothing
Set olApp = Nothing

End Sub