跳到主要內容

如何從Outlook中聯繫人的電話號碼中刪除國家/地區代碼?

在“聯繫人”窗口中,單擊 購物/首頁/傳真/電話 電話號碼前面的字段按鈕以激活“檢查電話號碼”對話框,如下圖所示,國家/地區代碼將自動添加到電話號碼之前。 但是,有時可能根本不需要區號,並且您想從所有電話號碼中刪除區號,如何處理? 請嘗試以下解決方案:

Office 標籤 - 在 Microsoft Office 中啟用選項卡式編輯和瀏覽,讓工作變得輕而易舉
Kutools for Outlook - 透過 100 多個進階功能增強 Outlook,實現卓越效率
使用這些進階功能增強您的 Outlook 2021 - 2010 或 Outlook 365。 享受全面的 60 天免費試用並提升您的電子郵件體驗!

箭頭藍色右氣泡從聯繫人的電話號碼中刪除國家/地區代碼

如果您只需要從聯繫人的一個電話號碼中刪除國家/地區代碼,則可以按以下方式手動將其刪除:

1。 在裡面 員工 通訊錄)視圖,單擊 瀏覽 > 更改視圖 > 電話。 看截圖:

2.雙擊以打開您的電話號碼,您將從中刪除國家/地區的聯繫人。

3.在打開的“聯繫人”窗口中,從指定電話中刪除加號和國家/地區代碼。 電話號碼 部分,然後單擊 聯絡我們 > 保存並關閉.

到目前為止,國家/地區代碼已從指定的電話號碼中刪除,如下圖所示:


箭頭藍色右氣泡使用VBA從聯繫人的電話號碼中刪除國家/地區代碼

如果您需要從Outlook中所有聯繫人的所有電話號碼中刪除國家/地區代碼,建議您使用VBA輕鬆處理。

1。 在裡面 員工 通訊錄)視圖中,打開聯繫人文件夾,您將在其中刪除所有聯繫人的國家代碼。

2。 按 其他 + F11 同時按下鍵以打開“ Microsoft Visual Basic for Applications”窗口。

3。 點擊 插入 > 模塊,然後將以下VBA代碼粘貼到新的打開的模塊腳本中。

VBA:從所有聯繫人的所有電話號碼中刪除國家/地區代碼

Sub FixPhoneFormat()

 Dim oFolder As MAPIFolder
Set oFolder = Application.ActiveExplorer.CurrentFolder

 If Left(UCase(oFolder.DefaultMessageClass), 11) <> "IPM.CONTACT" Then
MsgBox "You need to select a Contacts folder", vbExclamation
Exit Sub
End If

Dim nCounter As Integer
nCounter = 0

Dim oItem
For Each oItem In oFolder.Items
Dim oContact As ContactItem

          If TypeName(oItem) <> "DistListItem" Then
Set oContact = oItem
With oContact
.AssistantTelephoneNumber = FixFormatUSPhone(.AssistantTelephoneNumber)
.Business2TelephoneNumber = FixFormatUSPhone(.Business2TelephoneNumber)
.BusinessFaxNumber = FixFormatUSPhone(.BusinessFaxNumber)
.BusinessTelephoneNumber = FixFormatUSPhone(.BusinessTelephoneNumber)
.CallbackTelephoneNumber = FixFormatUSPhone(.CallbackTelephoneNumber)
.CarTelephoneNumber = FixFormatUSPhone(.CarTelephoneNumber)
.CompanyMainTelephoneNumber = FixFormatUSPhone(.CompanyMainTelephoneNumber)
.Home2TelephoneNumber = FixFormatUSPhone(.Home2TelephoneNumber)
.HomeFaxNumber = FixFormatUSPhone(.HomeFaxNumber)
.HomeTelephoneNumber = FixFormatUSPhone(.HomeTelephoneNumber)
.ISDNNumber = FixFormatUSPhone(.ISDNNumber)
.MobileTelephoneNumber = FixFormatUSPhone(.MobileTelephoneNumber)
.OtherFaxNumber = FixFormatUSPhone(.OtherFaxNumber)
.OtherTelephoneNumber = FixFormatUSPhone(.OtherTelephoneNumber)
.PagerNumber = FixFormatUSPhone(.PagerNumber)
.PrimaryTelephoneNumber = FixFormatUSPhone(.PrimaryTelephoneNumber)
.RadioTelephoneNumber = FixFormatUSPhone(.RadioTelephoneNumber)
.TelexNumber = FixFormatUSPhone(.TelexNumber)
.TTYTDDTelephoneNumber = FixFormatUSPhone(.TTYTDDTelephoneNumber)

.Save

nCounter = nCounter + 1
End With
End If
Next

MsgBox nCounter & " contacts processed.", vbInformation

End Sub

Private Function FixFormatUSPhone(Phone As String) As String

Phone = Trim(Phone)
FixFormatUSPhone = Phone
If Phone = "" Then Exit Function
Dim prefix As String
prefix = Left(Phone, 1)

' Configured for US
' Enter the correct prefix here
Do While (prefix = "+" Or prefix = "1")

' if the prefix is 2 digits, change to 4;
' if 3 digits, change to 5
Phone = Mid(Phone, 3)
prefix = Left(Phone, 1)
Loop

' After we clean up the country code, we remove non-numeric characters
' Can be tweaked to change formatting, ie: change 202.555.1212 to 202-555-1212

 Phone = Replace(Phone, "(", "")
Phone = Replace(Phone, ")", "")
Phone = Replace(Phone, ".", "")
Phone = Replace(Phone, " ", "")
Phone = Replace(Phone, "-", "")

 FixFormatUSPhone = Phone

End Function

4。 按 F5 鍵或單擊 Run按鈕運行此VBA。

5.然後會彈出一個對話框,向您顯示已處理了多少個聯繫人,請單擊 OK 按鈕將其關閉。

現在,您將看到國家/地區代碼已從所有聯繫人的所有電話號碼中刪除。 看截圖:


箭頭藍色右氣泡相關文章


最佳辦公生產力工具

Kutools for Outlook - 超過 100 種強大的功能可增強您的 Outlook

🤖 人工智慧郵件助手: 具備人工智慧魔力的即時專業電子郵件——一鍵天才回覆、完美語調、多語言掌握。輕鬆改變電子郵件! ……

📧 電子郵件自動化: 外出(適用於 POP 和 IMAP)  /  安排發送電子郵件  /  發送電子郵件時按規則自動抄送/密件副本  /  自動轉送(進階規則)   /  自動添加問候語   /  自動將多收件者電子郵件拆分為單獨的訊息 ...

📨 電子郵件管理: 輕鬆回憶電子郵件  /  按主題和其他人阻止詐騙電子郵件  /  刪除重複的電子郵件  /  進階搜索  /  合併資料夾 ...

📁 附件專業版批量保存  /  批量分離  /  批量壓縮  /  自動保存   /  自動分離  /  自動壓縮 ...

🌟 介面魔法: 😊更多又漂亮又酷的表情符號   /  使用選項卡式視圖提高 Outlook 工作效率  /  最小化 Outlook 而不是關閉 ...

👍 一鍵奇蹟: 使用傳入附件回覆全部  /   反網路釣魚電子郵件  /  🕘顯示寄件者的時區 ...

👩🏼‍🤝‍👩🏻 通訊錄和行事曆: 從選定的電子郵件中大量新增聯絡人  /  將聯絡人群組拆分為各組  /  刪除生日提醒 ...

超過 100特點 等待您的探索! 按此處了解更多。

閱讀更多       免費下載      購買
 

 

Comments (2)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
+91 60024 92129, +91 60065 92433, +91 6202 829 537, +91 6203 755 915, +91 6204 259 651, +91 6207 216 259, +91 6209 023 134, +91 6232 456 267, +91 6235 691 325, +91 6263 257 978, +91 6263 845 800, +91 6266 107 625, +91 6266 376 594, +91 6266 384 728, +91 6280 820 003, +91 6281 474 533, +91 6284 313 048, +91 6289 752 279, +91 6295 233 987, +91 6305 544 139, +91 6305 562 486, +91 6306 311 209, +91 6306 386 697, +91 6307 439 745, +91 6352 442 999, +91 6353 295 836, +91 6354 886 422, +91 6355 080 896, +91 6355 150 955, +91 6358 267 338, +91 6360 945 697, +91 6360 971 578, +91 6360 996 047, +91 6361 017 625, +91 6361 161 705, +91 6362 272 097, +91 6362 416 590, +91 6362 931 344, +91 6363 514 848, +91 6364 472 912, +91 6366 080 543, +91 6366 862 676, +91 6370 377 433, +91 6375 291 478, +91 6377 101 680, +91 6377 234 266, +91 6377 787 860, +91 6379 731 040, +91 6379 898 610, +91 6380 895 878, +91 6382 288 674, +91 6382 538 352, +91 6383 599 030, +91 6390 226 455, +91 6396 147 183, +91 6396 898 290, +91 6396 913 882, +91 70026 40668, +91 70030 97346, +91 70037 91315, +91 70041 99885, +91 70077 00459, +91 70088 43393, +91 70139 18583, +91 70151 73797, +91 70162 80468, +91 70163 84772, +91 70215 25584, +91 70223 73946, +91 70223 86042, +91 70261 00777, +91 70281 24252, +91 70312 12290, +91 70338 71811, +91 70348 41296, +91 70415 89862, +91 70483 07028, +91 70564 29288, +91 70578 80895, +91 70611 23745, +91 70619 46794, +91 70635 71388, +91 70661 15004, +91 70684 42618, +91 70692 27254, +91 70694 59872, +91 70819 32191, +91 70926 80424, +91 70969 19196, +91 70972 88194, +91 72000 70714, +91 72005 08588, +91 72044 36977, +91 72044 43276, +91 72049 22644, +91 72054 75784, +91 72075 24526, +91 72094 15297, +91 72183 02668, +91 72230 46597, +91 72249 40943, +91 72328 52648, +91 72400 41795, +91 72492 19541, +91 72591 96605, +91 72678 35455, +91 72749 39201, +91 72819 41453, +91 72838 35806, +91 72879 76908, +91 72920 57758, +91 72970 86260, +91 73057 12295, +91 73071 40929, +91 73077 05470, +91 73199 30398, +91 73239 20547, +91 73381 01005, +91 73386 35465, +91 73389 98301, +91 73…
This comment was minimized by the moderator on the site
this works well, although i would like to understand how it works more as it puts brackets, where i dont really need then. I am in Australia.
My other issue is that somehow, somewhere, it is reverting back to all having the country code
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations