A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

MailItem Find Method question



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old February 21st 10, 11:28 PM posted to microsoft.public.outlook.program_vba
Salad
external usenet poster
 
Posts: 24
Default MailItem Find Method question

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 " 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 & """")
 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Question on getExchangeUser method in Outlook Add-in paresh Outlook and VBA 3 October 13th 09 08:05 PM
question about AddStore method [email protected] Outlook and VBA 2 November 27th 07 06:53 PM
Find Method and Private Meetings Tadwick Outlook and VBA 6 August 28th 07 04:56 PM
Outlook find Method Meex Outlook and VBA 4 May 4th 07 07:25 AM
MailItem.SaveAs method Mrunali Outlook - Using Forms 0 April 17th 07 03:16 PM


All times are GMT +1. The time now is 03:40 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.