LockUserChanges 属性

       

返回或设置值,指出用户能否修改当前视图的设置。Boolean 类型,可读写。

expression.LockUserChanges

expression  必选。该表达式返回 View 对象。

说明

如果值为 True,用户可以修改当前视图的设置,但对界面的更改将不会保存。如果值为 False(默认值),所有更改都会保存。

示例

以下示例锁定对所有用户可用的视图用户界面。子例程 LockView 接受一个 View 对象和一个指出该视图界面是否锁定的 Boolean 值。本示例中调用该过程时 Boolean 值总是设置为 True

Sub LocksPublicViews()
'Locks the interface of all views that are available to
'all users of this folder

    Dim olApp As Outlook.Application
    Dim objName As NameSpace
    Dim objViews As Views
    Dim objView As View

    Set olApp = Outlook.Application
    Set objName = olApp.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