Outlook Address Book and Word

C

Cameron Powell

Ok, I keep posting little snippets of things relating to this. Basically
there are a bunch of little things that is doing wrong when pulling name and
address information from the outlook address book. The ultimate goal is I
want all of the name information that is entered to be used. If the prefix,
first name, middle name, last name, and suffix are entered I want ALL of it
to be used. Generally it will skip the prefix, but sometimes it doesn't. I
dont see why this so difficult. If it is displayed in the address book as Mr.
John E. Doe, Jr. it will pull it as such, but if it is displayed as John E.
Joe, Jr. it will pull it is that even though the Mr. is entered in the
appropriate field. Basically what I would like to find out is where the hell
word gets the information from. When I pull the name I use:
application.getaddress (,"<PR_DISPLAY_NAME>")
Where exactly is "Display Name" entered? It isn't "display as" because
changing that has no affect.
 
G

Graham Mayor

The <PR_Display_Name> field displays the name in the 'File As' dialog in the
Outlook Contacts. This is the detail shown in the Address Book (and changing
the File As dialog changes the Address Book entry).
You can test this by using the insert name from Outlook macro at
http://www.gmayor.com/Macrobutton.htm

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
C

Cameron Powell

Ok, I found out that the <PR_DISPLAY_NAME> comes from the subject field in
the Contact Fields. When I change that to various other things, it changes
when I try to insert it via <PR_DISPLAY_NAME> as well. I also noticed that
changing this moves in around in the address book. If I insert a Mr. in from
of the name. It then alphabetizes it by the Mr. instead of the name itself. I
guess the question would be is there anyway that I can pull information from
those fields as opposed to using <PR_DISPLAY_NAME> that would actually be
more valuable to me then knowing how to get the prefix and middle initial to
display via <PR_something>. The nice thing about using the fields is I can
also insert stuff into the user defined fields as well when there are those
special exceptions... I have a little snippet of code that could help out in
understanding what I am talking about. I don't know how to use this yet and
so far I keep getting "Specified Module Not Found"

Private Sub UserForm_Initialize()
Dim oApp As Outlook.Application
Dim oNspc As NameSpace
Dim oItm As ContactItem
Dim x As Integer
x = 0
Set oApp = CreateObject("Outlook.Application")
Set oNspc = oApp.GetNamespace("MAPI")
For Each oItm In oNspc.GetDefaultFolder(olFolderContacts).Items
With Me.cboContactList
.AddItem (oItm.FullName)
.Column(1, x) = oItm.BusinessAddress
.Column(2, x) = oItm.BusinessAddressCity
.Column(3, x) = oItm.BusinessAddressState
.Column(4, x) = oItm.BusinessAddressPostalCode
.Column(5, x) = oItm.Email1Address
End With
x = x + 1
Next oItm
Set oItm = Nothing
Set oNspc = Nothing
Set oApp = Nothing
End Sub

that snippet of code comes directly from Microsoft's website, and is part of
a userform that will display the info in a combo box so you can check what
you want to use... This is not what Im looking to do, but I figured this
would help in understanding what I'm talking about.
 
G

Graham Mayor

Unfortunately you can't have your cake and your ha'penny so I doubt that you
are going to be able to do this (though the Outlook group experts may know
better). the only way to access all the fields in Outlook is to use mail
merge *from Outlook* - see http://www.gmayor.com/mailmerge_from_outlook.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
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