automated task management in outlook using vba

G

Guest

hi,

as a first step in a larger project i am trying to implement a notification
when tasks are completed. i have figured out a way to do this, but only by
looping over the whole task list, which seems somewhat inefficient to me.
rather what i would like to do, is to get a grip on single tasks in the list,
however, so far i failed in doing this. if anyone knows a clearcut way to do
this, please let me know.

another strange thing is that i get two messages for each completed task
with a short timedelay of about 15 seconds, as if two events were triggered
and not only one. any clues on that one, would be welcome, too.

below is the code. so far the code pops up a message for every completed
task, even if only the status of another one has change. i am aware, that i
could add some code to suppress task triggering notification more than once,
by e.g. creating task ids, but that seems cumbersome. as i said, what i am
really looking for is to get a hold on specific tasks and not the task list.


Public WithEvents myOlItems As Outlook.Items

Sub Application_startup()
Set myOlItems =
Application.GetNamespace("MAPI").GetDefaultFolder(olFolderTasks).Items
End Sub

Private Sub myOlItems_ItemChange(ByVal item As Object)
For x = 1 To myOlItems.Count
If myOlItems.item(x).Complete = True Then
MsgBox "hello world"
End If
Next x
End Sub


thanks in advance!

cheers,

~smanky
 
S

Sue Mosher [MVP-Outlook]

Look at your definition of the ItemChange event handler: The Item argument for the procedure is the item that changed.

FYI, there is a newsgroup specifically for general Outlook programming issues "down the hall" at microsoft.public.outlook.program_vba or, via web interface, at http://www.microsoft.com/office/community/en-us/default.mspx?dg=microsoft.public.outlook.program_vba

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

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