Folder.CurrentView 属性 (Outlook)

返回一个代表当前视图的 View 对象。 只读。

语法

expressionCurrentView

表达 一个代表 Folder 对象的变量。

备注

若要获取当前的 资源管理器中 的视图的 视图 对象,使用 Explorer.CurrentView ,而不是当前 文件夹 对象返回的 Explorer.CurrentFolderCurrentView 属性。

您必须保存返回 CurrentView 之前继续将其用于任何目的的 视图 对象的引用。

若要正确重置当前视图,必须先执行 View.Reset ,然后再执行 View.Apply 。 下面的代码示例说明了调用顺序:

Sub ResetView() 
 
 Dim v as Outlook.View 
 
 ' Save a reference to the current view object 
 
 Set v = Application.ActiveExplorer.CurrentView 
 
 ' Reset and then apply the current view 
 
 v.Reset 
 
 v.Apply 
 
End Sub

示例

下列 VBA 示例显示了“收件箱”文件夹的当前视图。

Sub TestFolderCurrentView() 
 
 Dim nsp As Outlook.NameSpace 
 
 Dim mpFolder As Outlook.Folder 
 
 Dim vw As Outlook.View 
 
 Dim strView As String 
 
 
 
 Set nsp = Application.Session 
 
 Set mpFolder = nsp.GetDefaultFolder(olFolderInbox) 
 
 ' Save a reference to the current view 
 
 Set vw = mpFolder.CurrentView 
 
 MsgBox "The Current View is: " & vw.Name 
 
End Sub

另请参阅

文件夹对象

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。