Folder.CustomViewsOnly 属性 (Outlook)
返回或设置一个 boolean 类型的值 ,用于确定给定文件夹的 视图菜单上将显示哪些视图。 读/写。
语法
expression。 CustomViewsOnly
表达 一个代表 Folder 对象的变量。
备注
如果设置为 True ,只有用户创建的视图将显示在菜单上。
此属性仅对 "视图" 菜单起作用。 它不会影响导航窗格中视图的显示。
示例
下面的示例提示用户选择视图选项。 如果用户选择查看所有视图,将 CustomViewsOnly 属性设置为 False 。 如果用户选择查看仅自定义视图,则 CustomViewsOnly 属性设置为 True 。 属性更改后,可以在用户界面中看到这一变化的结果。
Sub SetCusView()
'Sets the CustomViewsOnly property depending on the user's response
Dim nmsName As Outlook.NameSpace
Dim fldFolder As Outlook.Folder
Dim lngAns As Long
Set nmsName = Application.GetNamespace("MAPI")
Set fldFolder = nmsName.GetDefaultFolder(olFolderInbox)
'Prompt user for input
lngAns = MsgBox( _
"Would you like to view only custom views in the View menu?", vbYesNo)
Call SetVal(fldFolder, lngAns)
End Sub
Sub SetVal(ByRef fldFolder As Folder, ByVal lngAns As Long)
'Modifies the CustomViewsOnly property to display views on the View menu
If lngAns = vbYes Then
fldFolder.CustomViewsOnly = True
Else
fldFolder.CustomViewsOnly = False
End If
'Display only custom views
If lngAns = vbYes Then
MsgBox "The View menu for the " _
& fldFolder.Name & " folder will now display only custom views."
'Display all views
Else
MsgBox "The View menu for the " _
& fldFolder.Name & " folder will now display all views."
End If
End Sub
另请参阅
支持和反馈
有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈