D
Dav Banks
Hi,
I'm having a bit of a problem getting the AdvancedSearchComplete to fire.
I'm sure my search is working - I added two message boxes after the search,
one so I could introduce a delay to allow the search to complete and a
second to check the count of the result. The count comes up good.
However, when I just let the function end and wait for the event to fire,
I get nothing. I'm sure it's something simple but I can't see it! Any ideas?
<--- Code --->
Public objSrch As Search
Public Sub Archive(fldSource As MAPIFolder, fldDestination As MAPIFolder,
date1 As Date, Optional recursive As Boolean = False)
Dim fldNewDest As MAPIFolder
Dim fldNewSource As MAPIFolder
Dim fldMail As MailItem
Dim i As Integer
Dim scope As String
Static cnt
Const srch As String = """urn:schemas:httpmail:datereceived"" <=
'1/1/2005'"
scope = "SCOPE ('shallow traversal of """ & fldSource.FolderPath &
"""')"
Set objSrch = Application.AdvancedSearch(scope, srch, False, "Test")
'Test Messages
'MsgBox "Filter = " & objSrch.Filter & Chr(13) _
& "Folder = " & objSrch.scope
'MsgBox objSrch.Results.Count
Set objSrch = Nothing
End Sub
Public Sub Application_AdvancedSearchComplete(ByVal SearchObject As Search)
Dim rslt As Outlook.Results
Set rslt = SearchObject.Results
MsgBox "Test1"
MsgBox SearchObject.Tag '& " Complete with " & rslt.Count & " results"
End Sub
<--- Code --->
db
I'm having a bit of a problem getting the AdvancedSearchComplete to fire.
I'm sure my search is working - I added two message boxes after the search,
one so I could introduce a delay to allow the search to complete and a
second to check the count of the result. The count comes up good.
However, when I just let the function end and wait for the event to fire,
I get nothing. I'm sure it's something simple but I can't see it! Any ideas?
<--- Code --->
Public objSrch As Search
Public Sub Archive(fldSource As MAPIFolder, fldDestination As MAPIFolder,
date1 As Date, Optional recursive As Boolean = False)
Dim fldNewDest As MAPIFolder
Dim fldNewSource As MAPIFolder
Dim fldMail As MailItem
Dim i As Integer
Dim scope As String
Static cnt
Const srch As String = """urn:schemas:httpmail:datereceived"" <=
'1/1/2005'"
scope = "SCOPE ('shallow traversal of """ & fldSource.FolderPath &
"""')"
Set objSrch = Application.AdvancedSearch(scope, srch, False, "Test")
'Test Messages
'MsgBox "Filter = " & objSrch.Filter & Chr(13) _
& "Folder = " & objSrch.scope
'MsgBox objSrch.Results.Count
Set objSrch = Nothing
End Sub
Public Sub Application_AdvancedSearchComplete(ByVal SearchObject As Search)
Dim rslt As Outlook.Results
Set rslt = SearchObject.Results
MsgBox "Test1"
MsgBox SearchObject.Tag '& " Complete with " & rslt.Count & " results"
End Sub
<--- Code --->
db