Outlook) (Items.FindNext 方法

Find 方法运行后,此方法将查找并返回指定集合中的下一步的 Outlook 项目。

语法

表达式。FindNext

表达式 表示 Items 对象的变量。

返回值

表示在集合中的下一个 Outlook 项目的 Object值。

备注

此搜索操作从当前位置,与以前用 Find 方法设置的表达式匹配开始。

Outlook 项目对象,如果该调用成功,则该方法返回如果失败,则返回 Null (或 任何 在 Visual Basic 中)。

示例

此Visual Basic for Applications (VBA) 示例使用 GetDefaultFolder 方法返回表示当前用户默认Calendar文件夹的 Folder 对象。 然后,它使用 Find 和 FindNext 方法来查找今天发生的所有约会,并将其显示在一系列消息框中。

Sub DemoFindNext() 
 Dim myNameSpace As Outlook.NameSpace 
 Dim tdystart As Date 
 Dim tdyend As Date 
 Dim myAppointments As Outlook.Items 
 Dim currentAppointment As Outlook.AppointmentItem 
 
 Set myNameSpace = Application.GetNamespace("MAPI") 
 tdystart = VBA.Format(Now, "Short Date") 
 tdyend = VBA.Format(Now + 1, "Short Date") 
 Set myAppointments = myNameSpace.GetDefaultFolder(olFolderCalendar).Items 
 Set currentAppointment = myAppointments.Find("[Start] >= """ & tdystart & """ and [Start] <= """ & tdyend & """") 
 While TypeName(currentAppointment) <> "Nothing" 
 MsgBox currentAppointment.Subject 
 Set currentAppointment = myAppointments.FindNext 
Wend 
End Sub

另请参阅

Items 对象

支持和反馈

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