![]() |
#4
|
||||
|
||||
![]()
In that case you probably won't want the following macro which will add the travel to any selected appointment
![]() Code:
Sub AddTravel() Dim olItem As AppointmentItem Dim olTravel As AppointmentItem Dim strTravel As String Dim iTravelMinutes As Integer strTravel = InputBox("Enter the travel time in minutes for each journey", "Travel Time", 60) If IsNumeric(strTravel) Then iTravelMinutes = Val(strTravel) Set olItem = ActiveExplorer.Selection.Item(1) If olItem.Class = olAppointment Then Set olTravel = CreateItem(olAppointmentItem) With olTravel .MeetingStatus = olNonMeeting .Subject = "Travel to " & olItem.Subject .Start = DateAdd("n", -iTravelMinutes, olItem.Start) .Duration = iTravelMinutes .Save End With Set olTravel = CreateItem(olAppointmentItem) With olTravel .MeetingStatus = olNonMeeting .Subject = "Return travel from " & olItem.Subject .Start = olItem.End .Duration = iTravelMinutes .Save End With End If End If lbl_Exit: Set olItem = Nothing Set olTravel = Nothing Exit Sub End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Sending Meeting Requests without Appointment Going into Diary | Confused! | Outlook | 0 | 11-02-2012 05:16 AM |
Outlook 2010 does not use default appointment time as shown in Options\Tasks\default | Axel | Outlook | 1 | 01-19-2012 09:39 AM |
Shared Calendar Attendee Appointment End Time | bmathis13 | Outlook | 8 | 11-21-2011 12:09 AM |
![]() |
april | Outlook | 2 | 06-23-2011 08:57 AM |
Recurring Appointment randomly changing time | rkryd03 | Outlook | 0 | 03-06-2007 10:25 AM |