View Single Post
  #1  
Old June 24th 09, 06:13 PM posted to microsoft.public.outlook.program_vba
C. Collings
external usenet poster
 
Posts: 2
Default ItemChange Event to Propagate Contacts

Hi,

I am trying to use the ItemChange event on Contacts.Items to execute VBA
code that will propagate the change to a contacts folder in my local PST file.

My question is two-part:
1. When I delete a contactitem from the contacts folder, the ItemChange
event fires and copies the deleted item to my PST file. How can I
distinguish the difference between changing an item or deleting an item using
VBA? If I also add code for the ItemRemove Event, will both events still
fire?

2. When I manually copy a contactitem from one folder to another it asks if
I want to update with changes or copy as a new item? When I propagate a
changed item using VBA, it adds the changed item as a new item rather than
merging the changed item with the existing item and doesn't give me an
option? Is there something I can do differently?

Sub ContactsFolder_ItemChange(ByVal Item As Object)
If InStr(Item.Categories, "Keyword") 0 Then
Dim Destination_Folder As MAPIFolder
Set Destination_Folder = GetFolder("Mailbox - Keyword\Contacts")
Set ContactItemCopy = Item.Copy
ContactItemCopy.Move Destination_Folder
Else
Set Destination_Folder = GetFolder("Mailbox - Local\Contacts")
Set ContactItemCopy = Item.Copy
ContactItemCopy.Move Destination_Folder
End If
End Sub

Thanks,
Collings
Ads