PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook VBA Programming Using AddNewMember for a Distribution list

Reply

Using AddNewMember for a Distribution list

 
Thread Tools Rate Thread
Old 25-02-2005, 01:33 PM   #1
=?Utf-8?B?Q2hhZCBDbGFuY3k=?=
Guest
 
Posts: n/a
Default Using AddNewMember for a Distribution list


I'd like to write what should be a pretty basic macro in VBA for Outlook.
Here's how it should work:


When I receive an email containing a particular subject line, I would like
to be able to move that email message to a specified folder, respond to the
sender with a specified message and add that sender's address to an existing
distribution list.

It looks like I can do the first two things with a rule and that adding the
email address to the distribution list may require some VBA. So, what I need
are some hints on how to extract the sender's email address from these
incoming emails and add it to a distribution list.

I have done quite a bit of VBA in Excel and Access but this will be my first
try at VBA in Outlook so I would appreciate any help from those more seasoned
than I.

Regards,
--
Chad Clancy
Modjeski and Masters, Inc.
  Reply With Quote
Old 25-02-2005, 02:16 PM   #2
Sue Mosher [MVP-Outlook]
Guest
 
Posts: n/a
Default Re: Using AddNewMember for a Distribution list

In Outlook 2003, you can use the MailItem.SenderEmailAddress.

In earlier versions, there is no Outlook property that returns the sender's
email address. You can either use CDO (or Redemption to avoid security
prompts -- http://www.dimastr.com/redemption/) to get the From address or
use Outlook to get the Reply To address. Sample code at
http://www.outlookcode.com/d/code/getsenderaddy.htm

To get the SMTP address from an Exchange sender or recipient, use CDO or
Redemption and the PR_EMAIL (&H39FE001E) MAPI property to obtain the SMTP
address from the AddressEntry object. See
http://www.outlookcode.com/d/code/g....htm#redemption and
http://www.cdolive.com/cdo5.htm#EMailAddressOfSender for examples.

For the DL, take a look at the Namespace.CreateRecipient and
DistListItem.AddMember methods.


--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"Chad Clancy" <ChadClancy@discussions.microsoft.com> wrote in message
news:78F8BE9C-7BCB-4BB5-B48B-4A01A29273B2@microsoft.com...
> I'd like to write what should be a pretty basic macro in VBA for Outlook.
> Here's how it should work:
>
>
> When I receive an email containing a particular subject line, I would like
> to be able to move that email message to a specified folder, respond to
> the
> sender with a specified message and add that sender's address to an
> existing
> distribution list.
>
> It looks like I can do the first two things with a rule and that adding
> the
> email address to the distribution list may require some VBA. So, what I
> need
> are some hints on how to extract the sender's email address from these
> incoming emails and add it to a distribution list.
>
> I have done quite a bit of VBA in Excel and Access but this will be my
> first
> try at VBA in Outlook so I would appreciate any help from those more
> seasoned
> than I.
>
> Regards,
> --
> Chad Clancy
> Modjeski and Masters, Inc.



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off