To update the Companies field with data from a
linked contact
All Outlook items have a property -- Contacts in the user
interface, Links in the object model -- that allows you to relate
the item to one or more contact records in any contacts folder. Many
Outlook items also have a Companies or Company property. You might
think that Companies would fill in automatically with the data from
a linked contact. It does on a task or appointment, but not on a
journal item (see Notes
below). This code takes care of that with routines that use the
ItemAdd and ItemChange events on the Journal folder's Items
collection to update the Companies field to either be blank if
Contacts is blank or show one company name if there is one link in
Contacts.
To try this code, paste it into the built-in ThisOutlookSession
module in VBA in Outlook 2000 or later.
|