How can I Display Appointment Info in a Message Box?

54 Views Asked by At

I want to pull the Appointment organizer, creation time and last modification time to display them in a message box.

Sub AppointmentDetails()

    Dim AppointmentItem As Object
    Set AppointmentItem = Application.ActiveInspector.CurrentItem

    Dim organizer As Object
    Set organizer = AppointmentItem.organizer

    Dim creationTime As Object
    Set creationTime = AppointmentItem.GetCreationTime

    Dim lastModification As Object
    Set lastModification = AppointmentItem.GetLastModificationTime

    MsgBox (organizer & vbNewLine & creationTime & vbNewLine & lastModification)

End Sub

Tweaking the script results in the debugger showing either error 424 or 461.

1

There are 1 best solutions below

0
Dmitry Streblechenko On

You need to use "set" only with objects, not with scalar values. The property names were also wrong (use CreationTime and LastModificationTime)

Sub AppointmentDetails()

    Dim AppointmentItem As Object
    Set AppointmentItem = Application.ActiveInspector.CurrentItem

    Dim organizer As Object
    organizer = AppointmentItem.organizer

    Dim creationTime As Object
    creationTime = AppointmentItem.CreationTime

    Dim lastModification As Object
    lastModification = AppointmentItem.LastModificationTime

    MsgBox (organizer & vbNewLine & creationTime & vbNewLine & lastModification)

End Sub