E
ErdoesiT
Hi,
I am trying write a VBA script that to copies a ContactItem and then
modifies the original item and its copy. Unfortunately the changes to
the source item are ignored.
The following piece of code can be used to reproduce this behaviour:
Public Sub Test()
Dim Namespace As Namespace
Dim Folder As MAPIFolder
Dim SourceItem As ContactItem
Dim TargetItem As ContactItem
Set Namespace = GetNamespace("MAPI")
Set Folder = Namespace.GetDefaultFolder(olFolderContacts)
'Copy first item in default contacts folder
Set SourceItem = Folder.Items(1)
Set TargetItem = SourceItem.Copy
'Modify source and target item
SourceItem.Body = "TargetItem: " & TargetItem.EntryID
TargetItem.Body = "SourceItem: " & SourceItem.EntryID
'Save changes
SourceItem.Save
TargetItem.Save
End Sub
Can anybody there tell me what's wrong with this script?
Thomas
I am trying write a VBA script that to copies a ContactItem and then
modifies the original item and its copy. Unfortunately the changes to
the source item are ignored.
The following piece of code can be used to reproduce this behaviour:
Public Sub Test()
Dim Namespace As Namespace
Dim Folder As MAPIFolder
Dim SourceItem As ContactItem
Dim TargetItem As ContactItem
Set Namespace = GetNamespace("MAPI")
Set Folder = Namespace.GetDefaultFolder(olFolderContacts)
'Copy first item in default contacts folder
Set SourceItem = Folder.Items(1)
Set TargetItem = SourceItem.Copy
'Modify source and target item
SourceItem.Body = "TargetItem: " & TargetItem.EntryID
TargetItem.Body = "SourceItem: " & SourceItem.EntryID
'Save changes
SourceItem.Save
TargetItem.Save
End Sub
Can anybody there tell me what's wrong with this script?
Thomas