none
In VBA, make outlook appoinment end in one hour RRS feed

  • Question

  • Hello All,

    I have VBA code that I use to create Outlook appointments based on spreadsheet data and I want to make the appointments I create end one hour after the start time.

    The start time is determined by the value in a spreadsheet which I capture in a variable ProposedTime.

    So in my code, my Start is = ProposedTime.Value and I want my End to be one hour later.

    How do I code that?

    Thanks,

    Alan

    <<relevant code>>

     With Application
            .EnableEvents = False
            .ScreenUpdating = False
        End With
      
        Set OutApp = CreateObject("Outlook.Application")
        Set OutMail = OutApp.CreateItem(1)
        
        On Error Resume Next
        
        With OutMail
            .Subject = Ticket.Value & ", Install of " & Product & " for " & EUName
            .Importance = True
            .Start = ProposedTime.Value
            .End = ProposedTime.Value +                  '(what do I add here to make the .End 1 hour after .Start ??
            .Body = "Attorney Chronology request sent:"
            .Display
        End With
     
        Set OutMail = Nothing
        Set OutApp = Nothing
        Unload Emy
    End Sub

    Thursday, February 14, 2019 9:19 PM

Answers

  • Use

            .End = ProposedTime.Value + TimeSerial(1, 0, 0)

    Alternatively, you can set the Duration property instead of the End property:

            .Duration = 60 ' minutes


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    • Marked as answer by Alan677 Thursday, February 14, 2019 10:06 PM
    Thursday, February 14, 2019 9:36 PM

All replies

  • Use

            .End = ProposedTime.Value + TimeSerial(1, 0, 0)

    Alternatively, you can set the Duration property instead of the End property:

            .Duration = 60 ' minutes


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    • Marked as answer by Alan677 Thursday, February 14, 2019 10:06 PM
    Thursday, February 14, 2019 9:36 PM
  • Hans,

    Thank you for your response.  For some reason the .End = ProposedTime.Value + TimeSerial(1, 0, 0) solution did not work for me, the meeting continued to be scheduled for 30 minutes, the default time. 

    But the duration = 60 worked so thank you and I'm set.

    Alan


     
    Thursday, February 14, 2019 10:09 PM