Finding the correct email address 
Author Message
 Finding the correct email address

I've written some code in Excel VBA that collects some data, composes and
sends an email to an address typed into a worksheet cell. It works well if I
type in the entire email address however if I just type in the name I get
the following error messge:

"Outlook does not recognize one or more names"

How can I get Outlook to find the right name or at least present me with the
opportunity to point in in the right direction?

Cell A5 is named recipeint and will only work if it contains

    Const olmailitem = 0
    Set objMail = OutlookApp.createitem(olmailitem)
    With objMail
          .Subject = subj
          .body = bodytext
          .to = Range("Recipient")
          .Send
    End With



Sat, 31 Aug 2002 03:00:00 GMT  
 Finding the correct email address
You should resolve the recipients before sending the message:

    .Recipients.ResolveAll

To be thorough, you should then loop through the Recipients collection,
checking to make sure each recipient has been resolved to a valid e-mail
address.
--
Sue Mosher
Author of
  "Teach Yourself Microsoft Outlook 2000 Programming in 24 Hours"
  "Microsoft Outlook 2000 E-mail and Fax Guide"

Outlook and Exchange solutions at http://www.slipstick.com


Quote:
> I've written some code in Excel VBA that collects some data, composes and
> sends an email to an address typed into a worksheet cell. It works well if
I
> type in the entire email address however if I just type in the name I get
> the following error messge:

> "Outlook does not recognize one or more names"

> How can I get Outlook to find the right name or at least present me with
the
> opportunity to point in in the right direction?

> Cell A5 is named recipeint and will only work if it contains

>     Const olmailitem = 0
>     Set objMail = OutlookApp.createitem(olmailitem)
>     With objMail
>           .Subject = subj
>           .body = bodytext
>           .to = Range("Recipient")
>           .Send
>     End With



Sun, 01 Sep 2002 03:00:00 GMT  
 Finding the correct email address
Sue,

Thanks, that gets me closer however it's off to BN to buy some more books at
lunch I think.

Rick



Quote:
> You should resolve the recipients before sending the message:

>     .Recipients.ResolveAll

> To be thorough, you should then loop through the Recipients collection,
> checking to make sure each recipient has been resolved to a valid e-mail
> address.
> --
> Sue Mosher
> Author of
>   "Teach Yourself Microsoft Outlook 2000 Programming in 24 Hours"
>   "Microsoft Outlook 2000 E-mail and Fax Guide"

> Outlook and Exchange solutions at http://www.slipstick.com



> > I've written some code in Excel VBA that collects some data, composes
and
> > sends an email to an address typed into a worksheet cell. It works well
if
> I
> > type in the entire email address however if I just type in the name I
get
> > the following error messge:

> > "Outlook does not recognize one or more names"

> > How can I get Outlook to find the right name or at least present me with
> the
> > opportunity to point in in the right direction?

> > Cell A5 is named recipeint and will only work if it contains

> >     Const olmailitem = 0
> >     Set objMail = OutlookApp.createitem(olmailitem)
> >     With objMail
> >           .Subject = subj
> >           .body = bodytext
> >           .to = Range("Recipient")
> >           .Send
> >     End With



Sun, 01 Sep 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. WebBrowser VB control Question (sorry this is the correct email address)

2. ! HELP SOS! correct email address: tigeron@bigpond.com

3. Problems finding correct IP address using WINSOCK Control with 2 network adapters

4. Problems finding correct IP address using WINSOCK Control with 2 network adapters

5. Finding Value of senders email address

6. WHERE DO I FIND THE SENDERS EMAIL ADDRESS

7. How to find out the email-address of the sender

8. Finding Sender's Address in EMail:No MAPI Object Model

9. Send a email to email-address with netscape ???

10. getting email senders Actual Email address

11. getting email senders actual email address

12. Obtaining email addresses from Global Address List

 

 
Powered by phpBB® Forum Software