Locking your Views against accidental changes

Custom Views can greatly improve your productivity as your emails, contacts or calendar folders are then presented exactly the way you want it. An often heard request is to be able to prevent changes being made to it later on or to be able to reset it back to the way you had it configured.

The usual workaround for this is to create a copy of your custom view so you’ll always be able to simply delete your modified version and create a fresh new copy.

A better approach would be to actually being able to lock your views. And even though this isn’t possible in Outlook itself, it is possible to lock down your views via a VBA macro.

The code sample provided in this guide gives you an easy to use interface to quickly lock or unlock your views.


LockViews macro

The LockViews macro allows you to easily set the LockUserChanges property of a view which is only accessible via code. The macro will check the property of all your views for the currently selected folder and then either locks or unlocks it based on your choice.

By assigning a button to the macro, you can quickly lock or unlock your views or see the current lock status of the view that you are using.

LockView macro: The status of your current view is: unlocked
Lock or unlock your views with the click of a button!

Note:
Once your view is locked, you can still make changes to it but these are not saved and thus your view is reset when you return to the folder. Selecting a different view will be remembered.

Quick Install

Use the following instructions to configure the macro in Outlook;

  1. Download this code-file (lockviews.zip) or copy the code below.
  2. Open the VBA Editor (keyboard shortcut ALT+F11)
  3. Extract the zip-file and import the LockViews.bas file via File-> Import…
    If you copied the code, paste it into a new module.
  4. Add a button for easy access to the macro.
  5. Sign your code.

A button can be added to the main Outlook window to quickly lock or unlock your views.
A button can be added to the main Outlook window to quickly lock or unlock your views.

Macro code

The following code is contained in the zip-file referenced in the Quick Install. You can use the code below for review or manual installation.


Click in the area above and press CTR+A to select all. Press CTRL+C to copy the code.