you can write a routine in VBA. All you've got to know:
(a) The VBA language.
(b) The MS Outlook objects, methods and properties.

Kees