A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Event of Changing the Task Status



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old December 15th 08, 02:27 AM posted to microsoft.public.outlook.program_vba
Mark
external usenet poster
 
Posts: 238
Default Event of Changing the Task Status

I would like to be able to execute some code when the user changes the status
of a task from "Not Started" to "Complete"
Any help would be appreciated

Mark
Ads
  #2  
Old December 15th 08, 11:41 AM posted to microsoft.public.outlook.program_vba
Alan Moseley
external usenet poster
 
Posts: 61
Default Event of Changing the Task Status

Put the following code into your ThisOutlookSession code window. It will
work when the task is opened and then completed:-

Dim WithEvents myInspectors As Inspectors
Dim WithEvents myTaskItem As TaskItem
Private Sub Application_Startup()
Set myInspectors = Outlook.Inspectors
End Sub
Private Sub myInspectors_NewInspector(ByVal Inspector As Inspector)
If TypeName(Inspector.CurrentItem) = "TaskItem" Then
Set myTaskItem = Inspector.CurrentItem
End If
End Sub
Private Sub myTaskItem_Close(Cancel As Boolean)
Set myTaskItem = Nothing
End Sub
Private Sub myTaskItem_PropertyChange(ByVal Name As String)
If Name = "Status" Then
If myTaskItem.Complete = True Then
MsgBox "Task " & myTaskItem.Subject & " now completed"
End If
End If
End Sub

Obviously replace the messagebox with your required code.
--
Alan Moseley IT Consultancy
http://www.amitc.co.uk

If I have solved your problem, please click Yes below. Thanks.


"Mark" wrote:

I would like to be able to execute some code when the user changes the status
of a task from "Not Started" to "Complete"
Any help would be appreciated

Mark

  #3  
Old March 12th 09, 09:58 AM posted to microsoft.public.outlook.program_vba
BMunk
external usenet poster
 
Posts: 8
Default Event of Changing the Task Status

This works when the task is opened in a window (Inspector).
How is it possible to get an event when the task status is changed with
"in-cell edits" enabled? There you don't have the inspector opened.

Thanks!

"Alan Moseley" wrote:

Put the following code into your ThisOutlookSession code window. It will
work when the task is opened and then completed:-

Dim WithEvents myInspectors As Inspectors
Dim WithEvents myTaskItem As TaskItem
Private Sub Application_Startup()
Set myInspectors = Outlook.Inspectors
End Sub
Private Sub myInspectors_NewInspector(ByVal Inspector As Inspector)
If TypeName(Inspector.CurrentItem) = "TaskItem" Then
Set myTaskItem = Inspector.CurrentItem
End If
End Sub
Private Sub myTaskItem_Close(Cancel As Boolean)
Set myTaskItem = Nothing
End Sub
Private Sub myTaskItem_PropertyChange(ByVal Name As String)
If Name = "Status" Then
If myTaskItem.Complete = True Then
MsgBox "Task " & myTaskItem.Subject & " now completed"
End If
End If
End Sub

Obviously replace the messagebox with your required code.
--
Alan Moseley IT Consultancy
http://www.amitc.co.uk

If I have solved your problem, please click Yes below. Thanks.


"Mark" wrote:

I would like to be able to execute some code when the user changes the status
of a task from "Not Started" to "Complete"
Any help would be appreciated

Mark

  #4  
Old March 12th 09, 02:14 PM posted to microsoft.public.outlook.program_vba
Alan Moseley
external usenet poster
 
Posts: 61
Default Event of Changing the Task Status

Try the following within your ThisOutlookSession code window:-

Dim WithEvents myTasks As Items
Private Sub Application_Startup()
Set myTasks =
Outlook.GetNamespace("MAPI").GetDefaultFolder.olFo lderTasks.Items
End Sub
Private Sub myTasks_ItemChange(ByVal Item As Object)
If Item.Complete = True Then
MsgBox "Task Complete"
End If
End Sub

--
Alan Moseley IT Consultancy
http://www.amitc.co.uk

If I have solved your problem, please click Yes below. Thanks.


"BMunk" wrote:

This works when the task is opened in a window (Inspector).
How is it possible to get an event when the task status is changed with
"in-cell edits" enabled? There you don't have the inspector opened.

Thanks!

"Alan Moseley" wrote:

Put the following code into your ThisOutlookSession code window. It will
work when the task is opened and then completed:-

Dim WithEvents myInspectors As Inspectors
Dim WithEvents myTaskItem As TaskItem
Private Sub Application_Startup()
Set myInspectors = Outlook.Inspectors
End Sub
Private Sub myInspectors_NewInspector(ByVal Inspector As Inspector)
If TypeName(Inspector.CurrentItem) = "TaskItem" Then
Set myTaskItem = Inspector.CurrentItem
End If
End Sub
Private Sub myTaskItem_Close(Cancel As Boolean)
Set myTaskItem = Nothing
End Sub
Private Sub myTaskItem_PropertyChange(ByVal Name As String)
If Name = "Status" Then
If myTaskItem.Complete = True Then
MsgBox "Task " & myTaskItem.Subject & " now completed"
End If
End If
End Sub

Obviously replace the messagebox with your required code.
--
Alan Moseley IT Consultancy
http://www.amitc.co.uk

If I have solved your problem, please click Yes below. Thanks.


"Mark" wrote:

I would like to be able to execute some code when the user changes the status
of a task from "Not Started" to "Complete"
Any help would be appreciated

Mark

  #5  
Old March 13th 09, 10:24 AM posted to microsoft.public.outlook.program_vba
BMunk
external usenet poster
 
Posts: 8
Default Event of Changing the Task Status

THANKS!

"Alan Moseley" wrote:

Try the following within your ThisOutlookSession code window:-

Dim WithEvents myTasks As Items
Private Sub Application_Startup()
Set myTasks =
Outlook.GetNamespace("MAPI").GetDefaultFolder.olFo lderTasks.Items
End Sub
Private Sub myTasks_ItemChange(ByVal Item As Object)
If Item.Complete = True Then
MsgBox "Task Complete"
End If
End Sub

--
Alan Moseley IT Consultancy
http://www.amitc.co.uk

If I have solved your problem, please click Yes below. Thanks.


"BMunk" wrote:

This works when the task is opened in a window (Inspector).
How is it possible to get an event when the task status is changed with
"in-cell edits" enabled? There you don't have the inspector opened.

Thanks!

"Alan Moseley" wrote:

Put the following code into your ThisOutlookSession code window. It will
work when the task is opened and then completed:-

Dim WithEvents myInspectors As Inspectors
Dim WithEvents myTaskItem As TaskItem
Private Sub Application_Startup()
Set myInspectors = Outlook.Inspectors
End Sub
Private Sub myInspectors_NewInspector(ByVal Inspector As Inspector)
If TypeName(Inspector.CurrentItem) = "TaskItem" Then
Set myTaskItem = Inspector.CurrentItem
End If
End Sub
Private Sub myTaskItem_Close(Cancel As Boolean)
Set myTaskItem = Nothing
End Sub
Private Sub myTaskItem_PropertyChange(ByVal Name As String)
If Name = "Status" Then
If myTaskItem.Complete = True Then
MsgBox "Task " & myTaskItem.Subject & " now completed"
End If
End If
End Sub

Obviously replace the messagebox with your required code.
--
Alan Moseley IT Consultancy
http://www.amitc.co.uk

If I have solved your problem, please click Yes below. Thanks.


"Mark" wrote:

I would like to be able to execute some code when the user changes the status
of a task from "Not Started" to "Complete"
Any help would be appreciated

Mark

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing the flag status Mark J Outlook and VBA 2 October 9th 08 03:48 PM
Event loop when saving Task item in event handler Mustafa Add-ins for Outlook 1 August 8th 08 06:24 PM
Changing status of meeting Nic Dillon Outlook - Calandaring 0 March 31st 08 11:58 AM
How do I stop an event from changing to recurring event automatica WON Outlook - Calandaring 1 March 2nd 08 09:42 PM
Differentiate between Task and Task Request in NewInspector event Piyush Gupta Outlook and VBA 1 February 7th 07 06:00 PM


All times are GMT +1. The time now is 11:20 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.