Outlook 2007 Macro Re Phone Fields of Contact

I have the following macro that if I have a phone number in the note field of 7136669999, when I run the macro it fixes the phone number to: 713.666.9999 But this macro does not do it when the phone number is in the business phone number field, the home phone number field or the cell phone number field. So what can we add to this for each phone number fields please, as this helps me very quickly in terms of my contacts.

Thanks very much!

Public Sub PhoneNumberFix()

Dim Ins As outlook.inspector
Dim Document As Word.Document
Dim Word As Word.Application
Dim Selection As Word.Selection

Set Ins = Application.ActiveInspector
Set Document = Ins.WordEditor
Set Word = Document.Application
Set Selection = Word.Selection

Selection.HomeKey Unit:=wdLine
Selection.MoveRight Unit:=wdCharacter, Count:=3
Selection.TypeText Text:="."
Selection.MoveRight Unit:=wdCharacter, Count:=3
Selection.TypeText Text:="."

End Sub

August 2nd, 2015 3:53pm

Imseaz,

Please don't post the same question to multiple forums threads. See Outlook 2007 Macro For Phone Number Fields of Contacts .

Free Windows Admin Tool Kit Click here and download it now
August 2nd, 2015 4:46pm

I figured out that when I copy the numbers that need to be fixed and then go to the business phone field, the following code copies the numbers directly to the note field, fixes it, copies it, deletes it from the note field an paste to the business phone field. So also, is there a code that pastes to the note field?

Public Sub BusinessPhoneNumberFixPaste()

Dim Ins As outlook.inspector
Dim Document As Word.Document
Dim Word As Word.Application
Dim Selection As Word.Selection

Set Ins = Application.ActiveInspector
Set Document = Ins.WordEditor
Set Word = Document.Application
Set Selection = Word.Selection


Selection.PasteAndFormat (wdPasteDefault)
Selection.MoveUp Unit:=wdLine, Count:=1
Selection.HomeKey Unit:=wdLine
Selection.MoveRight Unit:=wdCharacter, Count:=3
Selection.TypeText Text:="."
Selection.MoveRight Unit:=wdCharacter, Count:=3
Selection.TypeText Text:="."
Selection.HomeKey Unit:=wdLine
Selection.MoveRight Unit:=wdCharacter, Count:=12, Extend:=wdExtend
Selection.Copy
Selection.Delete Unit:=wdCharacter, Count:=1

Call PastetoBusinessPhone

End Sub
August 3rd, 2015 11:17am

Hi Imseaz,

This forum is for general questions and feedback related to Outlook. Since your question is more related to macro, I'd recommend you post a new question to the following forum for further assistance:

https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=outlookdev

The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

Steve Fan
TechNet Community Support

Free Windows Admin Tool Kit Click here and download it now
August 31st, 2015 9:16pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics