Results 1 to 4 of 4
  1. #1
    5 Star Lounger
    Join Date
    Mar 2001
    Location
    New York, NY
    Posts
    856
    Thanks
    0
    Thanked 9 Times in 8 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. Subscribe to our Windows Secrets Newsletter - It's Free!

    Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #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.

  4. #3
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,510
    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

  5. #4
    5 Star Lounger
    Join Date
    Mar 2001
    Location
    New York, NY
    Posts
    856
    Thanks
    0
    Thanked 9 Times in 8 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
  •