Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 06-23-2015, 03:48 AM
gmayor's Avatar
gmayor gmayor is offline Outlook diary, can you include travelling time to an appointment? Windows 7 64bit Outlook diary, can you include travelling time to an appointment? Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,137
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

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
Reply With Quote
 



Similar Threads
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
Outlook diary, can you include travelling time to an appointment? Meeting Appointment Not Showing Local Time april Outlook 2 06-23-2011 08:57 AM
Recurring Appointment randomly changing time rkryd03 Outlook 0 03-06-2007 10:25 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:34 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft