Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / March 2007

Tip: Looking for answers? Try searching our database.

Get e-mail address

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ulf Nilsson - 13 Mar 2007 14:40 GMT
Hi,
If I know a name from the global address book, can I get the e-mail address?

If Jon Smith is an entry in the global Address book, can I in some way
retrieve "Smith, Jon"  e-mail address? Using GetAddress does not seem to work.

I use Office XP.

// Ulf
Graham Mayor - 13 Mar 2007 15:02 GMT
See the method at http://www.gmayor.com/Macrobutton.htm

Signature

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

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> Hi,
> If I know a name from the global address book, can I get the e-mail
[quoted text clipped - 7 lines]
>
> // Ulf
Ulf Nilsson - 15 Mar 2007 14:49 GMT
Thanks for the link,
but I cannot see anything on how to get any e-mail address. Just to create a
contact.

The "<PR_EMAIL_ADDRESS>" does not work.

I'm looking forward to getting more idéas.

// Ulf

> See the method at http://www.gmayor.com/Macrobutton.htm
>
[quoted text clipped - 9 lines]
> >
> > // Ulf
Graham Mayor - 15 Mar 2007 17:07 GMT
You have to use your imagination a bit! There are several examples showing
how to pull data from Outlook which you can modify

Public Sub InsertEmailFromOutlook()
Dim strAddress As String
Dim strEmail As String
strEmail = "<PR_EMAIL_ADDRESS>"
strAddress = Application.GetAddress("", strEmail, _
False, 1, , , True, True)
Selection.TypeText strAddress
End Sub

will pull the e-mail address

Signature

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

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> Thanks for the link,
> but I cannot see anything on how to get any e-mail address. Just to
[quoted text clipped - 27 lines]
>>>
>>> // Ulf
Ulf Nilsson - 16 Mar 2007 07:57 GMT
I am sorry to tell you, but the code does not result in an e-mail address.
It just generates a long string:
"/o=[The name of the company]/ou=[The name of the
company]/cn=Recipients/cn=[A username]"

Sometimes, the "[A username]" is not the username, but something total
different.

How can I use the string to get e-mail addresses?

// Ulf

> You have to use your imagination a bit! There are several examples showing
> how to pull data from Outlook which you can modify
[quoted text clipped - 41 lines]
> >>>
> >>> // Ulf
Graham Mayor - 16 Mar 2007 09:19 GMT
The macro reads the e-mail field from Outlook and types it at the cursor. If
it doesn't read the e-mail address then the problem is almsot certainly with
the regional setting anomalies between your version of Windows and mine
which may imply different list separator characters. Maybe one of our
Scandinavian contributors will tell you what characters to substitute to
make it work for you.

Signature

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

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> I am sorry to tell you, but the code does not result in an e-mail
> address. It just generates a long string:
[quoted text clipped - 61 lines]
>>>>>
>>>>> // Ulf
Ulf Nilsson - 16 Mar 2007 12:07 GMT
Thank you Graham!
You helped me stop thinking in terms of "GetAddress". I solved it by using
GetObject and LDAP. The tool ADSIEdit from Microsoft is a great tool to see
the exact path to users.

The code:
Dim objSysInfo, adsUser
Set objSysInfo = CreateObject("ADSystemInfo")
Set adsUser = GetObject("LDAP://CN=Nilsson\,
Ulf,OU=Users,OU=Bor,OU=AV,DC=av,DC=se")
MsgBox adsUser.mail

Useful links:
http://www.rlmueller.net/LDAP_Binding.htm
http://www.tek-tips.com/viewthread.cfm?qid=920511&page=5
http://www.msexchange.org/articles/Scripting-Exchange-VBScript-ADSI-Part1.html

// Ulf

> The macro reads the e-mail field from Outlook and types it at the cursor. If
> it doesn't read the e-mail address then the problem is almsot certainly with
[quoted text clipped - 68 lines]
> >>>>>
> >>>>> // Ulf
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.