Hi,
I have a requirement to find emails from a particular sender. The way I would like to do it is to create an instance of outlook and automate the find function. Therefore displaying the found emails within outlook so the user can carry on from there replying or whatever to particular emails.
So far I have got to the point where I can open the inbox and select the Find commandbar button on the standard toolbar. Am I going about this the right way?
Here is the code that has got me the closest so far.
___________________________________________________
Function fFindEmails()
Dim outApp As New Outlook.Application
Dim nsp As Outlook.NameSpace
Dim mpfInbox As Outlook.MAPIFolder
Dim expInbox As Outlook.Explorer
Set nsp = outApp.GetNamespace("MAPI")
Set mpfInbox = nsp.GetDefaultFolder(olFolderInbox)
Set expInbox = mpfInbox.GetExplorer
With expInbox
.CommandBars.Item("Standard").Controls("Find").Execute
.Activate
End With
End Function
______________________________________________________
The code also has the failings in that the .execute part turns Find on and off and not just on.
Any pointers would be much appreciated or suggestions on other methods to resolve this one.
Many Thanks
Dan
I have a requirement to find emails from a particular sender. The way I would like to do it is to create an instance of outlook and automate the find function. Therefore displaying the found emails within outlook so the user can carry on from there replying or whatever to particular emails.
So far I have got to the point where I can open the inbox and select the Find commandbar button on the standard toolbar. Am I going about this the right way?
Here is the code that has got me the closest so far.
___________________________________________________
Function fFindEmails()
Dim outApp As New Outlook.Application
Dim nsp As Outlook.NameSpace
Dim mpfInbox As Outlook.MAPIFolder
Dim expInbox As Outlook.Explorer
Set nsp = outApp.GetNamespace("MAPI")
Set mpfInbox = nsp.GetDefaultFolder(olFolderInbox)
Set expInbox = mpfInbox.GetExplorer
With expInbox
.CommandBars.Item("Standard").Controls("Find").Execute
.Activate
End With
End Function
______________________________________________________
The code also has the failings in that the .execute part turns Find on and off and not just on.
Any pointers would be much appreciated or suggestions on other methods to resolve this one.
Many Thanks
Dan