Results 1 to 4 of 4
  1. #1
    5 Star Lounger
    Join Date
    Mar 2001
    Location
    New York, NY
    Posts
    860
    Thanks
    0
    Thanked 10 Times in 9 Posts

    Trouble using GetAddress method

    I'm using the GetAddress method to retrieve Contact info from Outlook (using VBA in Word.) If I work with one Contact at a time, I have no trouble. If I display the dialog box to use To: and CC: fields, I run into problems.

    My code:
    Code:
    sAdddress = Application.GetAddress("", , _
        UseAutoText:=False, DisplaySelectDialog:=1, SelectDialog:=2)
    Debug.Print sAddress
    The value of sAddress is:
    Robert Alexander, Esq., Dr. David Sutton
    Anthony Adami, Jr., John Kamp

    That's two To: Contacts and two CC: contacts. The To: and CC: contacts are separate by vbCrLf; Contacts are separated by a comma. But, as you can see above, there are commas in the Contact names, so I can't Split the line with a comma as my delimiter.

    Is there any other way to retrieve the selected names so that I can then pass the individual names back to GetAddress to get the Contact info (company, address, etc.)?

    Thanks.

  2. #2
    Star Lounger
    Join Date
    Feb 2011
    Location
    Washington, DC
    Posts
    87
    Thanks
    5
    Thanked 5 Times in 5 Posts
    Is there a way to get the source of this info to separate the contact names by tabs instead of commas? Otherwise I can see no solution since there is no way to tell the program which commas separate parts of a contact and which separate contacts from one another. It is fatally ambiguous.

  3. #3
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,514
    Thanks
    3
    Thanked 143 Times in 136 Posts
    From your sample, a dirty way to do this might be to replace the ., pattern with something else eg

    sAddress = Replace(sAddress,".,",".;")

    Of course this would fail if fullstop comma appears somewhere else other than between addressees.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  4. #4
    5 Star Lounger
    Join Date
    Mar 2001
    Location
    New York, NY
    Posts
    860
    Thanks
    0
    Thanked 10 Times in 9 Posts
    I think the possibility of failure is too great. "John Smith, Jr., M.D." would be an example of the pattern you mention.

Posting Permissions

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