locked
GetAddress Method and Word 2003 RRS feed

  • Question

  •  

    Is there any way to make the GetAddress Method to list the Outlook 2003 Company Name, Surname, and then Given Name in the Select Name dialog box sorted by Company Name first?

     

    When I use the GetAddress Method it lists the Name, Display Name, EMail Address, and then EMail type but it all cases the Name and Display Name is the same. I tried to use the AddAddress Method to make the PR_DISPLAY_NAME = Company but it still listed that entry by the persons name in both Name and Display Name when I tried the GetAddress again.

     

    Below is my code:

     

    Public Sub TEST()
    Dim strAddress
    Dim Company As String
    Dim Street As String
    Dim City As String
    Dim State As String
    Dim Zip As String


    strAddress = Application.GetAddress(AddressProperties:="<PR_COMPANY_NAME>" & "^" _
        & "<PR_STREET_ADDRESS>" & "^^" & "<PR_LOCALITY>" & "^^^" & _
        "<PR_STATE_OR_PROVINCE>" & "^^^^" & "<PR_POSTAL_CODE>")
    Company = Left(strAddress, (InStr(strAddress, "^") - 1))
    Street = Mid(strAddress, (InStr(strAddress, "^") + 1), ((InStr(strAddress, "^^")) - _
        (InStr(strAddress, "^") + 1)))
    City = Mid(strAddress, (InStr(strAddress, "^^") + 2), ((InStr(strAddress, "^^^")) - _
        (InStr(strAddress, "^^") + 2)))
    State = Mid(strAddress, (InStr(strAddress, "^^^") + 3), ((InStr(strAddress, "^^^^")) - _
        (InStr(strAddress, "^^^") + 3)))
    Zip = Right(strAddress, (Len(strAddress) - (InStr(strAddress, "^^^^") + 3)))

     

    Debug.Print Company
    Debug.Print Street
    Debug.Print City
    Debug.Print State
    Debug.Print Zip

     

    End Sub

    Sunday, June 1, 2008 5:41 PM