You have two options:
1) The Restrict method returns a filtered Items collection. With a UserForm
and a Listbox on it you can display the items.
2) Modifiy the CurrentView.Xml property. Outlook will show the result
directly itself.
--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Quick-Cats - The most effective way to assign Outlook categories:
http://www.shareit.com/product.html?...4&languageid=1
(German:
http://www.VBOffice.net/product.html?pub=6)
Am Thu, 15 Mar 2007 22:33:00 -0700 schrieb Charan:
Hi Bauer,
Thanks for your response.But i need to give the input
dynamically,based
on the input given by the User,Tasks should be filtered.Further this has
be
done by my application(my VBA code) and not by the Outlook predefined
Tasks
filter.
Here is my sample code.
Const olFolderTasks = 13
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objFolder = objNamespace.GetDefaultFolder(olFolderTasks)
Set objTask = objOutlook.CreateItem(olTaskItem)
Set colItems = objFolder.Items
strFilter = "[Subject] = 'qwe'"
Set coltasks = colItems.Restrict(strFilter)
For Each objTask In coltasks
objTask.Display
Next
Here instead of "objTask.Display" ,i need some other thing that should
show
only the filtered Tasks.Since "objTask.Display" will "open" all the
filtered
Tasks. I don't want to open the Tasks but to show the Tasks.