Solved

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

Posted on 2007-04-03
6
179 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
ID: 18870904
How do we know which item on the calendar is associated with that task?
0
 
LVL 1

Author Comment

by:PCLANTECHS
ID: 18889892
They have the same ticket number prefix
0
 
LVL 76

Expert Comment

by:David Lee
ID: 18916600
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
ID: 18917447
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
ID: 18930528
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Find out what you should include to make the best professional email signature for your organization.
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 …
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

813 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

18 Experts available now in Live!

Get 1:1 Help Now