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
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