CustomViewsOnly 属性 (Outlook)Folder.CustomViewsOnly property (Outlook)

返回或设置一个Boolean类型的值, 确定在给定文件夹的视图菜单上显示哪些视图。Returns or sets a Boolean that determines which views are displayed on the View menu for a given folder. 读/写。Read/write.

语法Syntax

expressionexpression. CustomViewsOnly

_表达式_一个代表Folder对象的变量。expression A variable that represents a Folder object.

说明Remarks

如果设置为True, 则仅用户创建的视图将显示在菜单上。If set to the True, only user-created views will appear on the menu.

此属性仅在 "视图" 菜单上有效。This property has an effect only on the View menu. 它不影响导航窗格中视图的显示。It does not affect the display of views in the navigation pane.

示例Example

下面的示例提示用户选择视图选项。The following example prompts the user to select a view option. 如果用户选择查看所有视图, CustomViewsOnly属性将设置为FalseIf the user chooses to view all views, the CustomViewsOnly property is set to False. 如果用户选择查看仅自定义视图,则 CustomViewsOnly 属性设置为 TrueIf the user chooses to view only custom views, the CustomViewsOnly property is set to True. 属性更改后,可以在用户界面中看到这一变化的结果。Once the property is changed, the outcome of the change can be seen in the user interface.

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

另请参阅See also

文件夹对象Folder Object

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.