Consulting

Results 1 to 3 of 3

Thread: VBA to modify appointment item in additional Exchange account doesn't work

  1. #1
    VBAX Newbie
    Joined
    Nov 2013
    Posts
    2
    Location

    VBA to modify appointment item in additional Exchange account doesn't work

    I am using 32-bit Outlook 2013. I am trying to modify properties of an existing, selected calendar item in an additional Exchange account in the profile (MultiEx). The code works against appointment items in the primary, i.e., first added, account in the profile. Additionally, it works against shared calendars that are open in the profile. It does not, however, work against selected appointment items in the calendar of the additional Exchange account.

    Sub SetAvailandReminder()
    Dim oAppt As Outlook.AppointmentItem
    Set oAppt = Application.ActiveExplorer.Selection.Item(1)
    oAppt.ReminderSet = False
    oAppt.BusyStatus = olFree
    oAppt.Save
    End Sub

    I don't get any error, just that the changes are not saved and reflected. I am able to display a MsgBox and output any of the properties of the item, so the selection object is correctly bound to the appointment item. I can't figure out why the same code works against the primary calendar and shared calendars, but not the multi-Ex account, even though it is correctly reading the appointment's properties.

    Scott

  2. #2
    VBAX Mentor skatonni's Avatar
    Joined
    Jun 2006
    Posts
    347
    Location
    My only thought is that you do not have the permission. Try to manually update these fields.
    To debug, mouse-click anywhere in the code. Press F8 repeatedly to step through the code. http://www.cpearson.com/excel/DebuggingVBA.aspx

    If your problem has been solved in your thread, mark the thread "Solved" by going to the "Thread Tools" dropdown at the top of the thread. You might also consider rating the thread by going to the "Rate Thread" dropdown.

  3. #3
    VBAX Newbie
    Joined
    Nov 2013
    Posts
    2
    Location
    Quote Originally Posted by skatonni View Post
    My only thought is that you do not have the permission. Try to manually update these fields.
    Well, of course, I have permission. You can't open a mailbox in multi-ex if you don't have FMA. Manually changing the properties does work. My intent is to use the macro so I don't have to manually change them. I have code that successfully creates an item in any calendar I have a time block selected:

    Sub CreateTravelAppointment(subject, starttime, duration, setreminder)
    'Create appointment item
    Set oFolder = Application.ActiveExplorer.CurrentFolder
    Set myItem = oFolder.Items.Add("IPM.Appointment")
    myItem.subject = subject
    myItem.Start = starttime
    myItem.duration = duration
    myItem.BusyStatus = olOutOfOffice
    If setreminder = False Then
    myItem.ReminderSet = False
    End If
    myItem.Save
    End Sub

    This why I am so confused why the selection object code isn't working to modify an item only in the multi-Ex calendar, when I can create one in it just fine.

    Scott

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •