Results 1 to 4 of 4
  1. #1
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: GetAddress Dialog (Word 97 +)

    Kevin,

    I don't have access to an Exchange environment anymore, but here is another way to return a specific OL folder, in case it is applicable to your situation (extending the code posted by Hubert):

    <pre> Dim myFolder As MAPIFolder
    Set myOlApp = CreateObject("Outlook.Application")
    Set myNameSpace = myOlApp.GetNamespace("MAPI")
    Set myFolder = myNameSpace.PickFolder
    Debug.Print myFolder.Name
    </pre>

    Here's the OL VBA help on 'PickFolder':
    <hr>The PickFolder method displays the Pick Folder dialog box. This is a modal dialog box which means that code execution will not continue until the user either selects a folder or cancels the dialog box. Returns a MAPIFolder object corresponding to the folder that the user selects in the dialog box. Returns Nothing when the dialog box is canceled by the user.<hr>
    Too bad Word doesn't have this method (I know, you can do it via an API...)

  2. #2
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: GetAddress Dialog (Word 97 +)

    Thank, Gar,

    I'll give this a try. I was not aware of that method. If it works, maybe you're
    spot on with "pitch Getadress". Hummm... I like sound of that. But, I need not
    just the folder, but a combobox with names.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

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

    Re: GetAddress Dialog (Word 97 +)

    I'm a bit (or a lot) out of my depth following this interesting discussion. Having written some rudimentary "... NameSpace.Pickfolder" code <!post=here,200296>here<!/post>, I'm pretty sure that you can get to any Folder exposed to the user, but, regarding Kevin's thread cross-reference, not the GAL.

    {Edit: never mind, Hubert, in the other thread, already tried myNameSpace.AddressLists("Global Address List").
    -John ... I float in liquid gardens
    UTC -7ąDS

  4. #4
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    GetAddress Dialog (Word 97 +)

    This <post#=244856>post 244856</post#> got me to thinking...others might find this useful too.

    This sub intercepts the Word InsertAddress button click to display the dialog and
    return the selected address.

    Using Sendkeys here solves the problem of selecting (in our case) the only useful address book in the list:
    an Exchange (via Outlook) Public Contact list. Since it's alwys the last in the list, it shows up in the dialog as the
    "default" AB.

    Even if the notoriously unreliable Sendkeys does not deploy, the user's are no worse off having to select the AB
    manually.

    Sub InsertAddress()
    SendKeys "%S^{End}"
    Selection.Text = Application.GetAddress(Name:="", AddressProperties:="*AddressLayout", UseAutoText:=True)
    Selection.Collapse wdCollapseEnd
    End Sub
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

Posting Permissions

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