0
votes
       Dim Fldr As Outlook.MAPIFolder
       Dim olMail As Variant   
       Dim myTasks As Outlook.Items 
       Set Fldr = olNs.GetDefaultFolder(olFolderInbox)  
       Set myTasks = Fldr.Items 
       Set olMail = myTasks.Find("[Subject] = ""8094676688""")

Am looking for outlook mail search vba code am using but in myTask and olMail am geting nothing want to know about the reason.Is anything miss or need to add something. Please help me out.

Thanks, Mohsin

1

1 Answers

0
votes

Think, this case is better to do via loop

Dim count as Long
count=0
For Each x in myTasks 
If x.Subject ="8094676688" Then 
count=count+1
ReDim Preserve  olMail (count)
olMail (count)=x
End If
next x