显示高级search的项目,而不保存在文件夹Outlook VBA中

我想通过excel vba在outlook中进行高级search,以便find一些电子邮件并创build一个自动回复其中之一。

我的问题是,我不知道如何处理作为一组项目的search结果,按datesorting,并回复最近的一个没有保存在任何search文件夹。

到目前为止,我只能运行高级search并将search结果保存到一个文件夹中:

Sub test() Dim Outl As Object Dim TESTEfolder As Object Dim Search As Object Set Outl = CreateObject("Outlook.Application") Set TESTEfolder = Outl.GetNamespace("MAPI").GetDefaultFolder(6).Folders("TESTE") Set Search = Outl.AdvancedSearch("'" & TESTEfolder.FolderPath & "'") Search.Save ("TESTEcopy") 'I want to skip this and handle the Items inside Search directly End Sub 

注意:我必须使用LATE绑定和高级search而不是Find / Restrict / InStr

谢谢!

您不需要保存search。 高级search完成后,Outlook.Application对象正在引发一个事件: https : //msdn.microsoft.com/VBA/Outlook-VBA/articles/application-advancedsearch-method-outlook