Having spent an hour or so learning enough Outlook VBA via Getting Started with VBA in Outlook 2010 and this snippet Change Contact's File As format I've managed to add some crude changes to the Updatemail macro to rewrite the FileAs field in "Last Name, Firstname" format which is what it was before HTC Sync 3 did its worst. (Modified code below.) This does the trick for me.
The final gripe is with the phone fields. If I put a Home Phone = 012345 6789 in the Microsoft Contact and then use HTC Sync 3 to copy this to Android 2.2 the space in the phone number is not stored. Has this been removed by HTC Sync 3? On a subsequent sync the space in the Outlook Contact is overwritten. Annoying. I'm not sure what to do about this one. Any ideas?
Paul
The final gripe is with the phone fields. If I put a Home Phone = 012345 6789 in the Microsoft Contact and then use HTC Sync 3 to copy this to Android 2.2 the space in the phone number is not stored. Has this been removed by HTC Sync 3? On a subsequent sync the space in the Outlook Contact is overwritten. Annoying. I'm not sure what to do about this one. Any ideas?
Paul
Code:
Sub UpdateMail()
Dim CurFolder
Dim MyItems
Dim MyItem
Dim NumItems, i
Dim sMail1, sMail2, sMail3
Dim sMailType1, sMailType2, sMailType3
Dim sMailFileAs As String
' Use whichever folder is currently selected
Set CurFolder = Application.ActiveExplorer.CurrentFolder
' Make sure it's a contact folder
If CurFolder.DefaultItemType = 2 Then
If MsgBox("This process may take some time. You will be notified when complete.", vbOKCancel, "Contact Tools Message") = vbOK Then
Set MyItems = CurFolder.Items
NumItems = MyItems.Count
For i = 1 To NumItems
Set MyItem = MyItems.Item(i)
If TypeName(MyItem) = "ContactItem" Then
Debug.Print MyItem
sMail1 = ""
sMail2 = ""
sMail3 = ""
sMailType1 = ""
sMailType2 = ""
sMailType3 = ""
sMailFileAs = ""
sMail1 = MyItem.Email1Address
sMail2 = MyItem.Email2Address
sMail3 = MyItem.Email3Address
sMailFileAs = MyItem.LastNameAndFirstName
sMailType1 = MyItem.Email1AddressType
sMailType2 = MyItem.Email3AddressType
sMailType3 = MyItem.Email3AddressType
MyItem.Email1Address = ""
MyItem.Email1Address = ""
MyItem.Email1Address = ""
MyItem.Email1DisplayName = ""
MyItem.Email2DisplayName = ""
MyItem.Email3DisplayName = ""
MyItem.FileAs = sMailFileAs
MyItem.Save
If Trim(sMail1) > "" Then
MyItem.Email1Address = sMail1
End If
If Trim(sMail2) > "" Then
MyItem.Email2Address = sMail2
End If
If Trim(sMail3) > "" Then
MyItem.Email3Address = sMail3
End If
MyItem.Save
End If
Next
End If
MsgBox "Finished updating contacts."
Else
MsgBox "The current folder must be a contacts folder."
End If
Set MyItem = Nothing
Set MyItems = Nothing
Set CurFolder = Nothing
End Sub
Upvote
0