A
Alexander Hunziker
Hi
I am trying to write a macro for Outlook XP that changes all my
contact's telephone numbers to a format where they start with "+".
Here's what I did:
Sub ResolveContactAddressViaCheckNames()
Dim ol As Outlook.Application
Dim olns As NameSpace
Dim myContact As Object
Dim Menu As Object
Dim Command As Object
Dim i, j As Long
Dim OldNumber, NewNumber As String
Set ol = New Outlook.Application
Set olns = ol.GetNamespace("MAPI")
i = olns.GetDefaultFolder(olFolderContacts).Items.Count
For j = 1 To i
Set myContact =
olns.GetDefaultFolder(olFolderContacts).Items.Item(j)
With myContact
If Not .HomeTelephoneNumber = "" Then
OldNumber = .HomeTelephoneNumber
NewNumber = "+" & OldNumber
myContact.HomeTelephoneNumber = NewNumber
myContact.Save
End If
End With
Next j
End Sub
Unfortunately, the field myContact.HomeTelephoneNumber doesn't get
updated. NewNumber does contain what I want it to contain, though.
Any ideas?
Thanks, Alex
I am trying to write a macro for Outlook XP that changes all my
contact's telephone numbers to a format where they start with "+".
Here's what I did:
Sub ResolveContactAddressViaCheckNames()
Dim ol As Outlook.Application
Dim olns As NameSpace
Dim myContact As Object
Dim Menu As Object
Dim Command As Object
Dim i, j As Long
Dim OldNumber, NewNumber As String
Set ol = New Outlook.Application
Set olns = ol.GetNamespace("MAPI")
i = olns.GetDefaultFolder(olFolderContacts).Items.Count
For j = 1 To i
Set myContact =
olns.GetDefaultFolder(olFolderContacts).Items.Item(j)
With myContact
If Not .HomeTelephoneNumber = "" Then
OldNumber = .HomeTelephoneNumber
NewNumber = "+" & OldNumber
myContact.HomeTelephoneNumber = NewNumber
myContact.Save
End If
End With
Next j
End Sub
Unfortunately, the field myContact.HomeTelephoneNumber doesn't get
updated. NewNumber does contain what I want it to contain, though.
Any ideas?
Thanks, Alex