Article ID: 174476
Article Last Modified on 2/12/2007
' Set the MyFldr object to the default Inbox.
Set MyFldr = Item.Application.GetNameSpace("MAPI").GetDefaultFolder(6)
' MyVar is the subject of the mail message to search for.
' Change this to match a mail message in your Inbox.
MyVar = "Please read!"
' This is the standard approach without using a variable.
Set Itm = MyFldr.Items.Find("[Subject] = ""Please read!""")
' This approach uses Chr(34) to represent a quotation mark.
Set Itm = MyFldr.Items.Find("[Subject] = " & Chr(34) & MyVar & Chr(34))
' This approach uses double quotation marks to represent a
' quotation mark.
Set Itm = MyFldr.Items.Find("[Subject] = """ & MyVar & """")
' Display the date/time the found mail message was created (just
' for verification purposes).
MsgBox Itm.CreationTime
166738 OL97: How to Install Visual Basic Help
169751 OL97: Errors in Outlook Visual Basic Help (Vbaoutl.hlp)
166368 OL97: How to Get Help Programming with Outlook
170783 OL97: Q&A: Questions about Customizing or Programming Outlook
Additional query words: OutSol OutSol97
Keywords: kbcode kbhowto kbprogramming KB174476