• Remove +1 from phone numbers (Outlook 2000)

    Home » Forums » AskWoody support » Productivity software by function » MS Outlook and email programs » Remove +1 from phone numbers (Outlook 2000)

    Author
    Topic
    #364549

    Someone deliberately added +1 to all local phone numbers, but now wants the +1 removed. He did not use the “automatically add country code to local phone numbers” option, but changed each contact individually. Is there a way to remove the +1 from local numbers in some automatic fashion so that he (i.e., his secretary) does not have to open and update each contact individually?

    Viewing 2 reply threads
    Author
    Replies
    • #559962

      Many apologies, as I’m pressed for time, but before the secretary gets put into the pressure cooker, I’m pretty sure that this can be done by code. Hopefully someone will come up with some pre-made code snippets before I resurface. Bit out of touch with current local dialling rules in the US. Does a + get recognised before the area code, or do you need a 0, and did they put a space or a hyphen or nothing between the 1 and the area code?

    • #559989

      Still waiting? See if this does what you want. It matches “+1 ” as the first three characters of four different phone numbers. It removes those first three characters and saves the change, sweeping through the entire contacts folder in one go. You could add checks for home and “other” numbers if they are an issue.

      Sub DeletePlusOne()
      'Delete +1 from all contacts' phone numbers
      'Does not ask for confirmation on individual changes
      Dim aContact As ContactItem
      If MsgBox("This will scan the current folder.  Okay?", vbQuestion + vbYesNo) _
          = vbNo Then Exit Sub
      'next line will err if not in a contact folder
      For Each aContact In ActiveExplorer.CurrentFolder.Items
          If Left(aContact.BusinessTelephoneNumber, 3) = "+1 " Then
              aContact.BusinessTelephoneNumber = _
                  Right(aContact.BusinessTelephoneNumber, _
                          Len(aContact.BusinessTelephoneNumber) - 3)
              aContact.Save
          End If
          If Left(aContact.BusinessFaxNumber, 3) = "+1 " Then
              aContact.BusinessFaxNumber = _
                  Right(aContact.BusinessFaxNumber, _
                          Len(aContact.BusinessFaxNumber) - 3)
              aContact.Save
          End If
          If Left(aContact.Business2TelephoneNumber, 3) = "+1 " Then
              aContact.Business2TelephoneNumber = _
                  Right(aContact.Business2TelephoneNumber, _
                          Len(aContact.Business2TelephoneNumber) - 3)
              aContact.Save
          End If
          If Left(aContact.CompanyMainTelephoneNumber, 3) = "+1 " Then
              aContact.CompanyMainTelephoneNumber = _
                  Right(aContact.CompanyMainTelephoneNumber, _
                          Len(aContact.CompanyMainTelephoneNumber) - 3)
              aContact.Save
          End If
      Next
      MsgBox "Done!"
      End Sub

      Hope this helps.

      • #560051

        Thank you very much! I’ll give it a go.

      • #560158

        I get a “type mismatch” error when running this code on the Contacts folder. I know next to nothing about vb, so I’m having trouble figuring out the problem. Any help appreciated.

        • #560239

          If you’re actually viewing the contacts, it should work. My default view is the little cards, if that makes any difference (it shouldn’t). If you click Debug…, which line is highlighted?

    • #560252

      Could you not do an export to csv
      Run a find and replace to remove the +1 in Excel
      Import back in.
      ?

    Viewing 2 reply threads
    Reply To: Remove +1 from phone numbers (Outlook 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: