Solved

How to automatically have a scheduled item update when the task updates in Outlook 2003?

Posted on 2007-04-03
6
174 Views
Last Modified: 2010-04-08
We are looking for a better way to associate Tasks in Outlook 2003 with the Calendar.  We would like it so that when someone updates the time in Tasks, it automatically updates the time of the associated scheduled item in the Calendar.  Thanks
0
Comment
Question by:PCLANTECHS
  • 3
  • 2
6 Comments
 
LVL 76

Expert Comment

by:David Lee
Comment Utility
How do we know which item on the calendar is associated with that task?
0
 
LVL 1

Author Comment

by:PCLANTECHS
Comment Utility
They have the same ticket number prefix
0
 
LVL 76

Expert Comment

by:David Lee
Comment Utility
Is this information in the subject line of both items?  Also, how long is the ticket numbr prefix and is it alphanumeric?
0
 
LVL 1

Author Comment

by:PCLANTECHS
Comment Utility
The information is in both the subject lines.  The prefix would be alphanumeric and would include the clients name or business name.  An Example would be "M05_Client Name, "
0
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
Comment Utility
Got it.  Ok, we can accomplish this with a script like the one below.  This code monitors the Tasks folder watching for items being changed.  When it sees a change it searches the Calendar for a matching item.  If it finds a match, then it updates the appointment.  If it finds more than one match, then it displays an error message.  I tested this code using Outlook 2003 and it worked perfectly.  Follow these instructions to use it.

1.  Start Outlook
2.  Click Tools->Macro->Visual Basic Editor
3.  If not already expanded, expand Microsoft Office Outlook Objects and click on ThisOutlookSession
4.  Copy the code marked as going in ThisOutlookSession and paste it into the right-hand pane of the VB Editor window
5.  Edit the code as needed.  I placed a comment line immediately before each line that needs editing
6.  Click the diskette icon on the toolbar to save the changes
7.  Close the VB Editor
8.  Click Tools->Macro->Security
9.  Set the Security Level to Medium
10.  Close Outlook
11.  Start Outlook
12.  Outlook will display a dialog-box warning that ThisOutlookSession contains macros and asking if you want to allow them to run.  Say yes.  Yoou can avoid having to do this each time by signing the code.  Instructions for doing that are here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoxpta/html/odc_dsvba.asp


Public WithEvents olkItems As Outlook.Items

Private Sub Application_Quit()
    Set olkItems = Nothing
End Sub

Private Sub Application_Startup()
    Set olkItems = Session.GetDefaultFolder(olFolderTasks).Items
End Sub

Private Sub olkItems_ItemAdd(ByVal Item As Object)
    'Code to process the task item being added
    'We could add code here that would create an appointment each time a task is added
End Sub

Private Sub olkItems_ItemChange(ByVal Item As Object)
    Dim olkCalendar As Outlook.Items, _
        olkMatches As Outlook.Items, _
        olkAppointment As Outlook.AppointmentItem, _
        strKey As String
    Set olkCalendar = Session.GetDefaultFolder(olFolderCalendar).Items
    strKey = Item.Subject
    'This matches on the entire subject line.  If we need to use just a portion of the
    'subject line, then I'll need to know more about the subject line so I can figure a way
    'to extract just the portion we need.
    Set olkMatches = olkCalendar.Restrict("[Subject] = '" & strKey & "'")
    If olkMatches.Count = 1 Then
        Set olkAppointment = olkMatches.Item(1)
        With olkAppointment
            'I'm not clear on how you want the time updated, so this is just an example
            .Start = Item.DueDate
            .Save
        End With
    Else
        MsgBox "The calendar contains more than one appointment that matches the task." & vbCrLf & "Processing aborted.", vbCritical + vbOKOnly, "Update Associated Appointment"
    End If
    Set olkAppointment = Nothing
    Set olkMatches = Nothing
    Set olkCalendar = Nothing
End Sub

Private Sub olkItems_ItemRemove()
    'Code to process the task item being deleted
    'We could add code here that would delete the associated appointment
End Sub
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

My experience with Windows 10 over a one year period and suggestions for smooth operation
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now