Results 1 to 11 of 11
  1. #1
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: telephone number layouts by country (W2000+, O

    First, I would not use the Scripting runtime. Auntie Virus software often flags such use as a virus.

    Use API calls to get registry keys.

    Second, the Telephony API is described in the MSDN library, e.g., the Oct 2001 issue.

  2. #2
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: telephone number layouts by country (W2000+, O

    Andrew Lockton, Chrysalis Design, Melbourne Australia

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: telephone number layouts by country (W2000+, O

    I don't have enough examples to know, but I'm not convinced that Outlook is doing anything particularly intelligent here. For example, I get correspondence from some countries where they insert a hypen before the last digit, or spaces every 3 digits, but Outlook seems to generate the same final number each time. So... appearances aside, is this a problem for your application? Is it possible to assume that any hyphen is okay, and any other non-numeric character is a problem?

  4. #4
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: telephone number layouts by country (W2000+, O

    Yow, that's a lot to digest, but I'll dig into it. Thanks, Andrew.
    -John ... I float in liquid gardens
    UTC -7DS

  5. #5
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: telephone number layouts by country (W2000+, O

    You are correct that Outlook will accept just about anything in the phone fields, but it appears to attempt some default parsing of numbers by local convention. And my "application" isn't much more than an uncoded user form and a sinus headache (as opposed to a twinkle in my eye), plus existing code you and I contributed to the Outlook Forum, right now.

    The application will need to know, counting back from the -last- digit in the phone number, the length and position of the exchange and area code numbers, and I can figure that with Instr() <img src=/S/groan.gif border=0 alt=groan width=16 height=15> But to do that correctly for the various international phone number layouts, the user will have to feed the algorithm an accurate mask of the phone number structure.
    -John ... I float in liquid gardens
    UTC -7DS

  6. #6
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: telephone number layouts by country (W2000+, O

    Sorry, I was confused. I was using the detailed dialog, and didn't see that OL parses what you type into the "free form" space.

  7. #7
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: telephone number layouts by country (W2000+, O

    In the UK we don't have a fixed length for the Exchange part of the phone number, or for the actual phone number part. This means that a number like 0123456789 could be exchange 01234, number 56789, or exchange 0123 and number 456789 or...

    I believe that the only correct way to parse UK phone numbers is to step forwards from the beginning till you get an exact match on a known exchange - (Many years ago I did some work for a phone company helping to improve the algorithms they used for this purpose).

    StuartR

  8. #8
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: telephone number layouts by country (W2000+, O

    Stuart

    You didn't comment specifically on the total number of digits in UK phone numbers, which seems to vary all the way from 8 (e.g. Childline 0800 1111) to the more usual 11 (e.g. mobile phone numbers, 07712 345678, and ordinary geographic numbers, e.g. 020 8123 4567 for London and 01452 345678 for Gloucester).

    Your "testing for known exchanges" method seems the only viable method, but it would be a pig to maintain!

    John
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  9. #9
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    telephone number layouts by country (W2000+, Outlook 2000+)

    <P ID="edit" class=small>(Edited by JohnBF on 03-Mar-05 09:33. Fixed code for posterity, but it's not relevant to what I was looking for.)</P>I'm thinking of writing a simple Contact field Find-&-Replace VBA utility for Outlook, but can't figure out where the telephone number code layout 'masks' are stored. In the attached, I have circled the US telephone mask. Where can I get these?

    There is this telephony information in the registry:

    Sub GetRegTel()
    Const strKey As String = _
    "HKLMSOFTWAREMicrosoftWindowsCurrentVersionTelepho nyCountry List"
    Dim strC As String, strT As String
    Dim objWshShell As Object
    Dim intC As Integer

    Set objWshShell = CreateObject("Wscript.shell")
    Debug.Print "Name" & vbTab & "CountryCode" & vbTab & "SameAreaRule" _
    & vbTab & "LongDistanceRul" & vbTab & "InternationalRule"
    For intC = 1 To 999
    strC = intC & ""
    On Error Resume Next ' see if the country is valid
    strT = objWshShell.regread(strKey & strC & "Name")
    If Err.Number = 0 Then
    strT = objWshShell.regread(strKey & strC & "Name") & vbTab
    strT = strT & objWshShell.regread(strKey & strC & "CountryCode") & vbTab
    strT = strT & objWshShell.regread(strKey & strC & "SameAreaRule") & vbTab
    strT = strT & objWshShell.regread(strKey & strC & "LongDistanceRule") & vbTab
    strT = strT & objWshShell.regread(strKey & strC & "InternationalRule")
    Debug.Print strT
    End If
    Next intC
    Set objWshShell = Nothing
    End Sub

    Thanks to <!mskb=180408>Microsoft Knowledge Base Article 180408<!/mskb> & <!mskb=820937>Microsoft Knowledge Base Article 820937<!/mskb> the above now works, but the results don't tell me what I'm looking for, so I believe I'm looking down the wrong issue, or I need a way to interpret them. Can anyone direct me to where I get the Country setting and the applicable phone number mask?
    -John ... I float in liquid gardens
    UTC -7DS

  10. #10
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Vienna, Wien, Austria
    Posts
    5,009
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: telephone number layouts by country (W2000+, O

    On the "counting from the start front":

    Do you have a fixed population of countries that you will/are likely to be dealing with?<UL><LI>Even within the EU/OECD, a few countries have 3 digit country codes, although the majority have 2 digits.<LI>The international dialling prefix (before the country code) can vary from the standard "+" to one or two zeroes to a combination of digits.[/list]HTH
    Gre

  11. #11
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: telephone number layouts by country (W2000+, O

    Thanks, Stuart, John and unkamunka. I think I'll have the utility ask the user to manually set the mask for the phone number content to be "Found-&-Replaced", and to heck with trying to guide them with a country-specific mask. More <img src=/w3timages/censored.gif alt=censored border=0> Instr() coding. <img src=/S/groan.gif border=0 alt=groan width=16 height=15>

    It's really a very simple concept, I'm just going to write the form in US English and post it some day to the Outlook Forum, public domain as nearly all Lounge code posts are.
    -John ... I float in liquid gardens
    UTC -7DS

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •