Changing the Behavior of Outlook Appointments


The genesis of this post is a comment left by James Cox on my last post. Here’s the salient part of James’ comment

While I don’t tweet, is there any chance I could use this forum to put a bee in your bonnet about a way to change Outlook 2010′s default behavior of creating a new meeting by opening the Appointment pane? It would make more sense to me for the Scheduling Assistant pane to open first, not the Appointment one. Also, if there was a way to get the Check Names action to automatically run when the Scheduling Assistant pane opened, I’d be ecstatic (…well, maybe not all the way there, but darned pleased at any rate…).

I had to think about James’ idea for a few minutes, not because it seemed difficult, but because I’d never done anything similar to what he’s asking for. As it turns out this is actually quite easy. All that’s required is to watch for new Inspector windows. This is a good place to explain about Outlook’s two window types: Explorers and Inspectors. An Explorer windows shows the contents of a folder (e.g. the inbox, contacts, a calendar) while an Inspector shows a particular item (e.g. a message, a contact, an appointment). Each time Outlook opens an inspector it triggers an event that we’ll trap in code. On detecting a new inspector the code will check to see if it contains an appointment or meeting request. If it doesn’t contain either of those, then nothing happens. When the inspector does contain an appointment/meeting request, then the code will resolve the list of attendees and force the display to the “Scheduling” tab.

While James is using Outlook 2010 this solution will work equally well in Outlook 2007.

Here’s hoping that James is “darned pleased” with this solution.

The solution comes in two parts.

Part 1.

Follow these instructions to add this code to Outlook.

  1. Start Outlook
  2. Press ALT+F11 to open the Visual Basic Editor
  3. If not already expanded, expand Microsoft Office Outlook Objects
  4. Right-click on Class Modules, select Insert > Class Module
  5. In the Properties panel click on Name and enter JHCox
  6. Copy the code from the Code Snippet box and paste it into the right-hand pane of Outlook’s VB Editor window
  7. Click the diskette icon on the toolbar to save the changes
Private WithEvents olkIns As Outlook.Inspectors

Private Sub Class_Initialize()
    Set olkIns = Application.Inspectors
End Sub

Private Sub Class_Terminate()
    Set olkIns = Nothing
End Sub

Private Sub olkIns_NewInspector(ByVal Inspector As Inspector)
    Dim olkApt As Outlook.AppointmentItem
    If Inspector.CurrentItem.Class = olAppointment Then
        Set olkApt = Inspector.CurrentItem
        With olkApt
            .Recipients.ResolveAll
            Inspector.SetCurrentFormPage "Scheduling"
        End With
    End If
    Set olkApt = Nothing
End Sub

Part 2.

Follow these instructions to add this code to Outlook.

  1. If not already expanded, expand Microsoft Office Outlook Objects and click on ThisOutlookSession
  2. Copy the code from the Code Snippet box and paste it into the right-hand pane of Outlook’s VB Editor window
  3. Edit the code as needed. I included comment lines wherever something needs to or can change
  4. Click the diskette icon on the toolbar to save the changes
  5. Close the VB Editor
  6. Click File and select Options
  7. When the Outlook Options dialog appears click Trust Center then click the Trust Center Settings button
  8. Click Macro Settings
  9. Select either of the two bottom settings (i.e. “Notifications for all macros” or “Enable all macros (not recommended; potentially dangerous code can run)”. The choice of which to chose is up to you. If you select “Notifications”, then you’ll be prompted at times to enable macros. If you pick “Enable all” then there’s a chance that a malicious macro could run. It’s a question of how much risk you want to assume.
  10. Click Ok until the dialog-boxes have all closed
  11. Close Outlook
  12. Start Outlook. Outlook will display a dialog-box warning that ThisOutlookSession contains macros and asking if you want to allow them to run. Say yes.
Private objJHCox As JHCox

Private Sub Application_Quit()
    Set objJHCox = Nothing
End Sub

Private Sub Application_Startup()
    Set objJHCox = New JHCox
End Sub
Advertisements

5 comments on “Changing the Behavior of Outlook Appointments

  1. Looks like the code above will not do the job if Outlook’s locale differs from en-US
    Form page name (“Scheduling” here) should be changed…

    • Inspector.CommandBars.ExecuteMso(“ShowSchedulingPage”);
      will do the job with the localized Outlook

  2. Works perfectly, of course – including when activated via Lync’s ‘Schedule a meeting’ menu option for a contact.

    However, as implemented in my instance of Outlook, the class name is DLee and the objects are objDLee (immortality is where you deserve it…).

  3. Pingback: Setting a Default Appointment Length « TechnicLee

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s