S
Salad
Using the Find method to find a Subject, I have a couple of questions.
If the Subject is "Test", the following code finds the email. If the
subject is "Re: Test", it does not. I have to remove the prefix. Why
is that?
If the subject is null, my code doesn't find the email. I figure
someone can send an email without a subject. Any idea on correcting it?
If Not IsNull(strSubject) Then
Set objMail = _
objNS.GetDefaultFolder(6).Items.Find("[Subject] = """ & _
strSubject & """")
Else
Set objMail = _
objNS.GetDefaultFolder(6).Items.Find("[Subject] Is Null")
End If
I have a question on finding the email by date as well. I pass a date
field to the function. It converts the date time to a string then
searches. Out of 10 email times passed to it, if found only 1. Any
idea whay the code below fails the majority of the time?
strTime = Format(datTime, "m/d/yyyy h:nn AMPM")
Set objMail = objNS.GetDefaultFolder(6).Items.Find("[ReceivedTime]= """
& strTime & """")
If the Subject is "Test", the following code finds the email. If the
subject is "Re: Test", it does not. I have to remove the prefix. Why
is that?
If the subject is null, my code doesn't find the email. I figure
someone can send an email without a subject. Any idea on correcting it?
If Not IsNull(strSubject) Then
Set objMail = _
objNS.GetDefaultFolder(6).Items.Find("[Subject] = """ & _
strSubject & """")
Else
Set objMail = _
objNS.GetDefaultFolder(6).Items.Find("[Subject] Is Null")
End If
I have a question on finding the email by date as well. I pass a date
field to the function. It converts the date time to a string then
searches. Out of 10 email times passed to it, if found only 1. Any
idea whay the code below fails the majority of the time?
strTime = Format(datTime, "m/d/yyyy h:nn AMPM")
Set objMail = objNS.GetDefaultFolder(6).Items.Find("[ReceivedTime]= """
& strTime & """")