Regardless of why you lose your favorite Microsoft Outlook view settings, it's easy to reclaim them with this simple macro.
Microsoft Outlook is extremely flexible with its view setting--not only can you control what you see, or don't see, you can create several views. That way, you can switch between views that support your different work tasks.
With all that viewing going on, you might end up with obscure settings when you launch Outlook the next time. That means before you can start working, most likely, you'll spend time resetting things. You could easily reset the view or, by using a simple macro, you can guarantee that Outlook starts with the view you want to use when you start working. This is also a good idea if you support users who are easily confused by random settings and options.
I'm using Outlook 365 on a Windows 10 64-bit system, but this will work in older versions. You can download the ThisOutlookSession.cls file and import it into Outlook rather than entering the code yourself. Don't try to paste the code from this web page--the Visual Basic Editor (VBE) won't be able to run it correctly. VBA code won't run in a browser version.
LEARN MORE: Office 365 Consumer pricing and features
How to reset your security macro settings
Out of the box, Office 365 is protective and disables all macros. Before you can run a macro, you'll need to reset your security macro settings unless you've already done so. Follow these steps to reset your security macro settings.
- Click the File tab, choose Options, and then click Trust Center in the left pane.
- Click the Trust Center Settings button in the Microsoft Outlook Trust Center section.
- In the left pane, click Macro Settings.
- In the Macro Settings, click Notifications For All Macros (Figure A). At a later date, you might want to change this, but for now, it gives you the most control and protection while also allowing the macro to run.
- Click OK twice.
It's worth noting that changing your macro settings comes with a bit of risk. Using the notification setting will allow Outlook to run macros, but it will prompt you first. You can choose not to enable macros at the prompt.
How to create a simple demonstration view
A view can have lots of settings, but we'll keep this one simple. Creating a view isn't the purpose of this article--setting it when you launch Outlook is. If you already have a named view that you work with, you can use it. Or, follow these steps to create a simple demonstration view.
- Select a folder, probably the Inbox for most users.
- Click Change View in the Current View group and choose Manage Views.
- In the resulting dialog, click New. (You could also select an existing view and click Modify.)
- Enter a name, such as ResetAtStartup (Figure B) and click OK.
- Click Columns and using Add and Remove set the columns you want in the view (Figure C). Click OK when you're done.
- Use the rest of the options to set the view properties you want to see in your startup view. (We will not set anything specific--I just want you to know where to find these options and how to name a view.)
- Click OK twice.
You now have a view with the specific settings and option you want in play when you launch Outlook. We'll refer to the view's name, ResetAtStartup, in the macro.
To reset the view when you launch Outlook, you'll use VBA's Startup event; specifically, that event will call a procedure that resets the view. You could reset the view within the Startup event, but because you might want to use that event for other things, it's best to call a separate procedure.
To create the macro, press Alt+F11 to open the Visual Basic Editor (VBE). Then, follow these steps.
- Select ThisOutlookSession in the Project window (to the left). If it isn't visible, choose Project Window from the View menu.
- Enter the code shown in Listing A.
- Save your work and then close the VBE.
- Close Outlook and then launch Outlook again.
Public Sub Application_Startup()
Run when launching Outlook.
Reset the view to ResetAtStartup.
Dim objViews As Views
Dim objView As View
Work with current folder.
Set objViews = Application.ActiveExplorer.CurrentFolder.Views
Identify the view.
Set objView = objViews.Item("ResetAtStartup")
Apply the view.
MsgBox "It worked"
The Startup event will call ResetView(), but nothing will happen until Outlook has added all its add-ins. To see that the VBA procedure worked, click the View tab and then click Change View. The selected view (Figure D) is ResetAtStartup.
It's rather simple. The Startup event calls ResetView, which defines and declares a few variables. The second Set statement identifies the demonstration view you created at the beginning of this article, ResetAtStartup. The next statement applies that view. The MsgBox() then displays a simple message to show it all worked. You can delete this last statement when applying this procedure to your own work—it's just there for show.
Although this macro is meant to reset the view when launching, the view is always available. Click the View tab and choose ResetAtStartup from the Change View dropdown in the Current View group. The macro resets things, so you or your users are ready to go.
Send me your Microsoft Office question
I answer readers' questions when I can, but there's no guarantee. Don't send files unless requested; initial requests for help that arrive with attached files will be deleted unread. You can send screenshots of your data to help clarify your question. When contacting me, be as specific as possible. For example, "Please troubleshoot my workbook and fix what's wrong" probably won't get a response, but "Can you tell me why this formula isn't returning the expected results?" might. Please mention the app and version that you're using. I'm not reimbursed by TechRepublic for my time or expertise when helping readers, nor do I ask for a fee from readers I help. You can contact me at firstname.lastname@example.org.
- 50 time-saving tips to speed your work in Microsoft Office (free PDF) (TechRepublic)
- Cost comparison calculator: G Suite vs. Office 365 (TechRepublic Premium)
- Microsoft Office has changed, how you use it should too (ZDNet)
- Best cloud services for small businesses (CNET)
- Best to-do list apps for managing tasks on any platform (Download.com)
- How to use Excel's advanced sorting options (TechRepublic)
- How to use named ranges to quickly navigate an Excel workbook (TechRepublic)
- How to add a drop-down list to an Excel cell (TechRepublic)
- How to use Windows 10 Task Scheduler to run Office 365 tasks (TechRepublic)
- More must-read Microsoft-related coverage (TechRepublic on Flipboard)
Affiliate disclosure: TechRepublic may earn a commission from the products and services featured on this page.