?
Solved

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

Posted on 2007-04-03
6
Medium Priority
?
188 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

If you troubleshoot Outlook for clients, you may want to know a bit more about the OST file before doing your next job. IMAP can cause a lot of drama if removed in the accounts without backing up.
This article describes how to import Lotus Notes Contacts into Outlook 2016, 2013, 2010 and 2007 etc. with a few manual steps. You can easily export and migrate Lotus Notes contacts into Microsoft Outlook without having to use any third party tools.
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Suggested Courses

770 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