Insert Outlook Contacts info into Word

W

Wendy

Using VBA from within Word, I can display the 'Select Name' dialog box via
the following code:-
strAddress = Application.GetAddress(AddressProperties:=strCode, _
UseAutoText:=False, DisplaySelectDialog:=1, _
RecentAddressesChoice:=True, UpdateRecentAddresses:=True)

However, my client has numerous Public folders and when you click on 'Public
Folders' in the dialog, it will not display the subfolders. They would like
to be able to select Contacts from all the subfolders underneath the Public
folders, as well as the normal address books etc.

It's not a permissions issue as the user has rights etc. to these folders
normally. Maybe I'm just missing a parameter to make all the subfolders
viewable? Any help would be appreciated.
 
C

Chuck

Unless someone else has a better idea...

It may have something to do with the AddressProperties:=strCode parameter.
When I strip that out your code allows me to see public folders. Not knowing
how you have strCode set up I can't test that, but perhaps if that's set to a
format that's not compatible with the public folders, then they won't show?

Sorry can't be of more help.
 
W

Wendy

Thanks for the idea Chuck but unfortunately it doesn't work for me. StrCode
was set as the fields that I wanted to extract for each contact i.e.
strCode = "<PR_GIVEN_NAME> <PR_SURNAME>" & vbCr & _
"<PR_COMPANY_NAME>" & vbCr & _
"<PR_POSTAL_ADDRESS>" & vbCr

If I remove the optional AddressProperties parameter, or set it to the text
equivalent of strCode shown below, I can still only see the heading "Public
Folders" but nothing within them.

strAddress = Application.GetAddress(AddressProperties:="<PR_GIVEN_NAME>
<PR_SURNAME>" , UseAutoText:=False, DisplaySelectDialog:=1, _
RecentAddressesChoice:=True, UpdateRecentAddresses:=True)

Any other ideas?
Thanks
Wendy
 
G

Graham Mayor

This surely has more to do with the ability to set the Contacts Lists
properties as Outlook Address Books, then that should give you the choice of
which address book to use when the code is run? I don't know a way to have
them all available concurrently and doubt that it is possible. Outlook's
newsgroup may be able to offer more insights.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top