|
各位大侠:
本人遇到一个难题,希望大家多多帮忙啊!
我想OutLook(2003版本)中自定义搜索某发件人的最近一次邮件的接受时间,下面是我在帮助文件中抄写的一段,但实现不了,大家帮忙改改错,如果可以的话可以写一些备注啊。
Sub TestAdvancedSearchComplete()
Dim objSch As Outlook.Search
Dim rsts As Outlook.Results
Dim myOlApp As New Outlook.Application
Dim myNameSpace As Outlook.NameSpace
Dim myFolder As Outlook.MAPIFolder
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myFolder = myNameSpace.GetDefaultFolder(olFolderInbox)
Dim i As Integer
Const strF1 As String = "urn:schemas:mailheader:SenderName ='+++'"
Set objSch = _
Application.AdvancedSearch(Scope:=myFolder, Filter:=strF1, SearchSubFolders:=True, Tag:="SubjectSearch")
Set rsts = objSch.Results
if rsts.count=0 then
MsgBox "此人没有给你发过邮件!"
else
MsgBox rsts.Item(1).ReceivedTime
end if
End Sub |
|