View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Richard Buttrey Richard Buttrey is offline
external usenet poster
 
Posts: 296
Default Lookup an email address in Outlook based on Username (newbie quest

On Fri, 19 Aug 2005 06:54:01 -0700, "HP"
wrote:

Hi,

Apologies if this question has been asked before - please direct to an
appropriate post if it has :-)

I have a column of usernames in an Excel spreadsheet and I would like to
find the corresponding email address by taking the username and doing a
lookup on all the email addresses in a global address list (by comparing the
username in the spreadsheet and username in Outlook, and returning the email
address if a match is found).

Anyone have any ideas how I could do this - or even if it is possible.

many thanks in advance.


I use this to identify whether a name in a Cell is to be found in an
Outlook contact list. No doubt you could modify it slightly to achieve
your task. I actually enclose it in a Loop so that the
range("emailname") changes each time.

Dim olApp As Outlook.Application
Dim myrecipient
Dim Txtto As String

Set olApp = New Outlook.Application
Txtto=range("emailname")
Set myrecipient = olMail.Recipients.Add(Txtto)
If myrecipient.Resolve Then
MsgBox "Valid eMail Name"
else: MsgBox "Invalid eMailName"
End if


HTH



__
Richard Buttrey
Grappenhall, Cheshire, UK
__________________________