
So, my intention was to edit the code to get rid of the other 2 windows I am not interested in. When I opened Outlook again, it did what the code asked it to do - that is the good news! However, I do not want to open all 4 windows at Start-up, but only Inbox and Calendar. I therefore copied and pasted the entire code you provided above between these two sentences, saved the newly edited VBA project, closed it, returned to Outlook and closed Outlook. Under the line, there were two new sentences: 'Sub OpenTwoWindows' and 'End Sub'. That took me to the VBA editor, with the code of my original DeleteAttachments macro above a newly automatically inserted line after the entry 'End Sub' on that code. Hi Diane I went back to this issue, and thought I would need to go first to Macros and CREATE a new one, which I did, calling it 'ThisOutlookSession.OpenTwoWindows'.

In Outlook 2007 and older, look at Tools, Macro Security.Īfter you test the macro and see that it works, you can either leave macro security set to low or sign the macro. To check your macro security in Outlook 2010 and newer, go to File, Options, Trust Center and open Trust Center Settings, and change the Macro Settings. You can sign the macro when it is finished and change the macro security to notify. You could choose the option Notification for all macros, then accept it each time you restart Outlook, however, because it's somewhat hard to sneak macros into Outlook (unlike in Word and Excel), allowing all macros is safe, especially during the testing phase. The macros will not work with the top two options that disable all macros or unsigned macros. This snippet opens the windows then offsets each window from the previous window, with the Inbox on top.įirst: You need to have macro security set to the lowest setting, Enable all macros during testing. Set = objInboxĪ "normal" window open on screen. 'Set objInbox = Session.GetDefaultFolder(olFolderInbox) Set objTasks = Session.GetDefaultFolder(olFolderTasks) Set objContacts = Session.GetDefaultFolder(olFolderContacts) Set objCalendar = Session.GetDefaultFolder(olFolderCalendar) If you start up in a different folder, adjust the object names as needed. (Or use an on-screen ruler.)Īs written, this macro assumes you have Outlook starting up in the Inbox (in File, Options, Advanced) and want it maximized. Use Snagit or another image editor to find the position (in pixels) of the upper left corner of each window and the window size. Tip: to get the window size and position, adjust the windows on screen and take a screenshot. When the macro is finished, the Inbox is brought into focus and maximized. Each window can have a unique size and position.

This startup macro will open the windows in the order listed when Outlook starts up. But with VBA almost anything is possible.
