UlfNilsson
Fri Mar 16 06:07:00 CDT 2007
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
"Graham Mayor" wrote:
> 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.
>
> --
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Graham Mayor - Word MVP
>
> My web site www.gmayor.com
> Word MVP web site
http://word.mvps.org
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>
>
>
> Ulf Nilsson wrote:
> > 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
> >
> > "Graham Mayor" wrote:
> >
> >> 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
> >>
> >>
> >> --
> >> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> >> Graham Mayor - Word MVP
> >>
> >> My web site www.gmayor.com
> >> Word MVP web site
http://word.mvps.org
> >> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> >>
> >>
> >>
> >>
> >> Ulf Nilsson wrote:
> >>> 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
> >>>
> >>> "Graham Mayor" wrote:
> >>>
> >>>> See the method at
http://www.gmayor.com/Macrobutton.htm
> >>>>
> >>>> --
> >>>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> >>>> Graham Mayor - Word MVP
> >>>>
> >>>> My web site www.gmayor.com
> >>>> Word MVP web site
http://word.mvps.org
> >>>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> >>>>
> >>>> Ulf Nilsson wrote:
> >>>>> 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
>
>
>