View.LockUserChanges Property (Outlook)
Published: July 16, 2012
Returns or sets a Boolean value that indicates whether a user can modify the settings of the current view. Read/write.
The following example locks the user interface for all views that are available to all users. The subroutine LockView accepts the View object and a Boolean value that indicates if the View interface will be locked. In this example the procedure is always called with the Boolean value set to True.
Sub LocksPublicViews() 'Locks the interface of all views that are available to 'all users of this folder. Dim objName As Outlook.NameSpace Dim objViews As Outlook.Views Dim objView As Outlook.View Set objName = Application.GetNamespace("MAPI") Set objViews = objName.GetDefaultFolder(olFolderNotes).Views For Each objView In objViews If objView.SaveOption = olViewSaveOptionThisFolderEveryone Then Call LockView(objView, True) End If Next objView End Sub Sub LockView(ByRef objView As View, ByVal blnAns As Boolean) 'Locks the user interface of the view. 'Accepts and returns a View object and user response. With objView If blnAns = True Then 'if true lock UI .LockUserChanges = True .Save Else 'if false don't lock UI .LockUserChanges = False End If End With End Sub