- Joined
- May 3, 2012
- Messages
- 1
- Reaction score
- 0
the code below is an advancedsearch for outlook. i only have one email that fits the search term "test 2". if the code works, the number of items found is assigned to b. when i run the code sometimes it finds it other times it does not. however, when i step through, the code always works (finds the email item) ..... Any ideas ?
Sub advancedsearch1()
Dim search As Outlook.search
Dim results As Outlook.results
Dim b As Integer
'start coding
Set search = AdvancedSearch("inbox", "urn:schemas:mailheader:subject = 'test 2'")
Set results = search.results
b = results.Count
Debug.Print b
Set search = Nothing
Set results = Nothing
End Sub
Sub advancedsearch1()
Dim search As Outlook.search
Dim results As Outlook.results
Dim b As Integer
'start coding
Set search = AdvancedSearch("inbox", "urn:schemas:mailheader:subject = 'test 2'")
Set results = search.results
b = results.Count
Debug.Print b
Set search = Nothing
Set results = Nothing
End Sub