Closing Multiple Outlook Message Windows


One benefit I get from being on Twitter, and one of the reasons I like the service so much, is idea generation. People talk about features they’d like to see in a product, complain about features it’s lacking, and ask whomever is listening on Twitter for help figuring out how to use it to get a particular task done. While some of the suggestions are just plain crazy, many of them make perfect sense. Sometimes I slap my forehead after reading a tweet with an idea and wonder “Why didn’t I think of that?” Of course the answer is really simple. I don’t use the product/service the same way the author of the tweet does and therefore never realized the need. Necessity really is the mother of invention.

Here’s an example. I was scanning Outlook related tweets and ran across this one from Michael Mullen (@idiottech):

Microsoft Outlook needs a better way to close multiple emails. Closing each email is totally inefficient.

Michael has a good point, but one I’d never considered before because I rarely have more than two messages open at once. I can sympathize with Michael though because I frequently have multiple windows open in Outlook’s code editor and have found myself wishing there was a way to close them all without the need to close each one individually. While I can’t solve my problem, I can solve Michael’s.

[Note: As pointed out by JP (in comments below) Outlook already has the ability to close all open Windows with minimal effort. Sometimes I get too wrapped up in an idea and forget about existing features. In Outlook 2007 you can close all open windows by clicking File and selecting Close All Items. In Outlook 2010 the selection is on the ribbon’s View tab. This solution is unnecessary if you simply want to close all open windows. However, if you want to close some, but not all, then this solution may still be useful.]

The solution is a combination of a userform (userforms are what VBA calls custom dialog-boxes) and a macro that calls it. Here’s how it works. On opening, the userform builds and presents a list of all open message windows. Each item in the list includes a checkbox for selecting it. Michael can pick which items he wants to close or use the checkbox labeled “All” that appears just below the list to select all items with a single click. He can also choose to save any changes he’s made to the open items by checking the “Save” option. If he doesn’t choose “Save”, then by default the code will discard changes to each open item as it closes it. Clicking the “Close” button is the final step. As you might have guessed, this closes the selected message windows. Here’s an example. Say that Michael has ten messages open. Today it’d take him 10 clicks to close them all. With this he can do it in three clicks. One click to run the macro, another to check the “All” box which will select everything in the list, and finally the “Close” button to close them all. Oh, and this solution isn’t limited to message windows. It will work on appointments, contacts, tasks, and notes too, or any combination of open windows.

Manage Outlook Windows Dialog-box

Manage Outlook Windows Dialog-box

This solution comes in two parts.

Part 1.

Follow these instructions to add the userform to Outlook.

  1. Download the .zip file from this link
  2. Unzip the file
  3. Start Outlook
  4. Press ALT+F11 to open the Visual Basic Editor
  5. Click File and select Import File
  6. Navigate to the folder you saved the files to in step #2
  7. Select the file frmCloseMultiple

Part 2.

Follow these instructions to add this code to Outlook.

  1. If not already expanded, expand Microsoft Office Outlook Objects
  2. If not already expanded, expand Modules
  3. Select an existing module (e.g. Module1) by double-clicking on it or create a new module by right-clicking Modules and selecting Insert > Module.
  4. Copy the code from the Code Snippet box and paste it into the right-hand pane of Outlook’s VB Editor window
  5. Edit the code as needed. I included comments wherever something needs to or can change
  6. Click the diskette icon on the toolbar to save the changes
  7. Close the VB Editor
Sub RunCloseAll()
    Dim objFrm As New frmCloseMultiple
    objFrm.Show vbModal
    Set objFrm = Nothing
End Sub

One Click

Running the macros with a single click requires a bit more work. In Outlook 2003 and 2007 we’ll add a button to the toolbar. Outlook 2010 uses the ribbon, so for this version we’ll add a button to the Quick Access Toolbar (QAT).

Outlook 2003/2007. Follow these instructions to add toolbar buttons that run these macros.

Outlook 2010. Follow these instructions to add both macros to the QAT.

Advertisements

7 comments on “Closing Multiple Outlook Message Windows

  1. Pingback: Changing the Behavior of Appointments « TechnicLee

  2. David –

    Think about integration with the Inbox and with Lync.

    If I select a message (even without opening it) from the inbox and then click on the Meeting item in the Respond group of Outlook’s ribbon, it opens a meeting window with all the email recipients already included as attendees. The context/content of the meeting notice often depends on who is or isn’t going to be available before the meeting issue has to be dealt with.

    Actually, my most frequent use is from Lync – to see the calendar of someone I need to talk to, but whose Lync status indicates is not current available. One of the Lync options is to schedule a meeting, but all I really want is to look at the person’s calendar…

  3. David –

    Unless you’re using Win 7 / 64bit, maybe I can alleviate your problem with closing mutiple windows in the VBIDE. Just go to

    http://www.mztools.com/v3/download.aspx

    and download MZ-Tools 3.0 for VBA. Closing multiple code windows is just one of the features of this program – I’ve been using it for > 6 years and it’s amazing !

    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…).

    • Hi, James.

      Thanks, I’ll check out that tool.

      Yes, please use this as a forum for suggestions. Those are interesting requests. I think I can force a meeting request to open to the scheduling assistant. I can probably check names too, but I’m not sure I see the value in running it when the form is first opened. There wouldn’t be any names entered yet so what would there be to check?

  4. “Microsoft Outlook needs a better way to close multiple emails. Closing each email is totally inefficient.”

    The userform idea is great, but there’s already a built-in way to do this. Go to File > Close All Items. In Outlook 2010 I believe the option has moved to the View menu, otherwise it’s the same process: View > Close All Items.

    • Doh! You’re right. How could I have forgotten that? Thanks for reminding me, JP. Of course that’s a faster way to close all open windows. This solution adds the ability to select which windows are closed.

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