shalun » 16.04.2008 (Ср) 13:40
уже порыскал - нашел то, что нужно, есть еще несколько нюансов.
кому интересно:
Function NewNumber(OldNumber As String) As String
NewNumber = Replace(OldNumber, "+7 495", "+7 (495)")
`NewNumber = Replace(OldNumber, "+7 499", "+7 (499)")
`NewNumber = Replace(OldNumber, "+7 901", "+7 (901)")
`NewNumber = Replace(OldNumber, "+7 903", "+7 (903)")
`NewNumber = Replace(OldNumber, "+7 910", "+7 (910)")
`NewNumber = Replace(OldNumber, "+7 916", "+7 (916)")
`NewNumber = Replace(OldNumber, "+7 926", "+7 (926)")
`NewNumber = Replace(OldNumber, "+7 963", "+7 (963)")
`NewNumber = Replace(OldNumber, "+7 812", "+7 (812)")
`NewNumber = Replace(OldNumber, "+7 10 375 17", "+375 (17)")
`NewNumber = Replace(OldNumber, "+7 4922", "+7 (4922)")
`NewNumber = Replace(OldNumber, "*", " доб. ")
`NewNumber = Replace(OldNumber, "+7 48762", "+7 (48762)")
`NewNumber = Replace(OldNumber, "+7 4912", "+7 (4912)")
End Function
Sub ChangePhoneNumbers()
Dim myOlApp As Outlook.Application
Dim myNameSpace As Outlook.NameSpace
Dim myContacts As Outlook.Items
Dim myItem As Object
Dim myPhone As ItemProperty
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myContacts = _
myNameSpace.GetDefaultFolder(olFolderContacts).Items
For Each myItem In myContacts
If (myItem.Class = olContact) Then
myItem.Display
For Each myPhone In myItem.ItemProperties
If (myPhone.Name Like "*phone*") Or _
(myPhone.Name Like "*fax*") Then
myPhone.Value = NewNumber(myPhone.Value)
End If
Next
myItem.Close olSave
End If
Next
End Sub
теперь нужно разобраться почему не меняются номера в "факс рабочий" и как "хранить как" изменить.
Я в макросах не рублю совсем аутлуковских - придется разбираться(