PC Review


Reply
Thread Tools Rate Thread

Code to automate tasks in Outlook

 
 
vonclausowitz@gmail.com
Guest
Posts: n/a
 
      4th Oct 2005
Goodday all,

I want to know if it is possible to create some VB code to update field
in Outlook tasks on a click event.
I have created a user-defined field named Updater in my Outlook tasks.
I want to get this field updated automatically when I click a Task away
as Completed.
In other words:

When I clikc on a Task to complete it the field Updater must be edited
and updated with mu Username automatically...

Is this possible?

Regards
Marco

 
Reply With Quote
 
 
 
 
Pedro CR
Guest
Posts: n/a
 
      5th Oct 2005
have you tryed creating a custom Task form? probably there will be some kind
of data type for it
you also have the option to write VBS (not VBA) code to automate the custom
form.


<(E-Mail Removed)> escreveu na mensagem
news:(E-Mail Removed)...
> Goodday all,
>
> I want to know if it is possible to create some VB code to update field
> in Outlook tasks on a click event.
> I have created a user-defined field named Updater in my Outlook tasks.
> I want to get this field updated automatically when I click a Task away
> as Completed.
> In other words:
>
> When I clikc on a Task to complete it the field Updater must be edited
> and updated with mu Username automatically...
>
> Is this possible?
>
> Regards
> Marco
>



 
Reply With Quote
 
Michael Bauer
Guest
Posts: n/a
 
      5th Oct 2005
Am 4 Oct 2005 11:27:10 -0700 schrieb (E-Mail Removed):

Marco, one approach is to track the folder item´s ItemChange events. If the
event is being fired then check then item´s Status property, if it´s
completed then check for your UserProperty.

Note: For the ability to track more than one folder at once you´ll also need
an Explorer wrapper, that is an instance of a class module for each Explorer
which is being opened.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook

> Goodday all,
>
> I want to know if it is possible to create some VB code to update field
> in Outlook tasks on a click event.
> I have created a user-defined field named Updater in my Outlook tasks.
> I want to get this field updated automatically when I click a Task away
> as Completed.
> In other words:
>
> When I clikc on a Task to complete it the field Updater must be edited
> and updated with mu Username automatically...
>
> Is this possible?
>
> Regards
> Marco

 
Reply With Quote
 
vonclausowitz@gmail.com
Guest
Posts: n/a
 
      5th Oct 2005
Is there an example of VB code for Outlook tasks to do so?

Marco

 
Reply With Quote
 
Michael Bauer
Guest
Posts: n/a
 
      6th Oct 2005
Am 5 Oct 2005 10:27:35 -0700 schrieb (E-Mail Removed):

A sample for the ItemChange event is available in the VBA help. Another
one for the Explorer wrapper on
http://www.microeye.com/resources/ItemsCB.zip

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook

> Is there an example of VB code for Outlook tasks to do so?
>
> Marco

 
Reply With Quote
 
vonclausowitz@gmail.com
Guest
Posts: n/a
 
      8th Oct 2005
I found out that it is not possible to trap the status Completed
because when you click a Task as completed then it dissapears and a new
task appears. This new task is then checked for it's status which is
then of course always not completed.

Marco

 
Reply With Quote
 
Michael Bauer
Guest
Posts: n/a
 
      8th Oct 2005
Am 8 Oct 2005 02:38:56 -0700 schrieb (E-Mail Removed):

Ok, then you have to do a lot of work. You need to track every single
TaskItem. That is you need additionally an Inspector wrapper (same mechanism
as for the Explorer) and need to track the Explorer´s SelectionChange event
if its current folder is a task folder.

The goal is to receive each TaskItem´s PropertyChange event.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook

> I found out that it is not possible to trap the status Completed
> because when you click a Task as completed then it dissapears and a new
> task appears. This new task is then checked for it's status which is
> then of course always not completed.
>
> Marco

 
Reply With Quote
 
vonclausowitz@gmail.com
Guest
Posts: n/a
 
      8th Oct 2005
Wooh,

Sounds complicated. Is that a procedure which would take a long time
considering I have about 800 tasks?

How would the code look like?

Any short sample to get me starting?

Marco

 
Reply With Quote
 
Michael Bauer
Guest
Posts: n/a
 
      8th Oct 2005
Am 8 Oct 2005 05:01:30 -0700 schrieb (E-Mail Removed):

I´m not sure what you´re asking for. You don´t have to reference each item
at once. You need a reference on each opened TaskItem and one on the
currently selected TaskItem (if any) in each opened Explorer. In that way
you´re able to track each TaskItem´s events, which an user could edit.

Please see also the VBA help. There´re samples for all mentioned events:
NewInspector, PropertyChange, SelectionChange.

For one TaskItem in an Explorer the code looks like this:

Private WithEvents m_oTask as Outlook.TaskItem
Private WithEvents m_oExplorer As Outlook.Explorer

Private Sub Application_Startup()
Set m_oExplorer = Application.ActiveExplorer
End Sub

Private Sub m_oExplorer_SelectionChange()
If m_oExplorer.CurrentFolder.DefaultItemType = olTaskItem Then
Set m_oTask = m_oExplorer.Selection(1)
End If
End Sub

Private Sub m_oTask_PropertyChange(ByVal Name As String)
If Name="Complete" Then
If m_oTask.Complete=True Then
' ...
Endif
Endif
End Sub

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook

> Wooh,
>
> Sounds complicated. Is that a procedure which would take a long time
> considering I have about 800 tasks?
>
> How would the code look like?
>
> Any short sample to get me starting?
>
> Marco

 
Reply With Quote
 
vonclausowitz@gmail.com
Guest
Posts: n/a
 
      8th Oct 2005
Michael,

When trying this code I get an error message saying:

"Array index out of bounds" on the next lines:

Private Sub oExplorer_SelectionChange()

If oExplorer.CurrentFolder.DefaultItemType = olTaskItem Then
----->> error ---> Set oTask = oExplorer.Selection(1)
End If

End Sub

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i automate outlook tasks using access data =?Utf-8?B?YW5kZXZ1dGNo?= Microsoft Access Database Table Design 0 7th Sep 2006 04:34 PM
Outlook should automate ability to view schedule tasks on outlook. =?Utf-8?B?Um9iZXJ0IEFUTA==?= Microsoft Outlook Calendar 1 26th Apr 2006 08:07 PM
Automate a status report from Outlook tasks (vbscript) John McGee via OfficeKB.com Microsoft Outlook VBA Programming 0 19th May 2005 07:56 PM
Looking for a way to automate some tasks in Outlook 2003 Milhouse Van Houten Microsoft Outlook 3 15th Jan 2005 09:58 PM
How to automate tasks such as seting up mailbox in Outlook express? gino Windows XP Help 10 21st Jul 2004 11:10 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:13 PM.