List of 'unsubscribe' senders to Excel

M

michael.beckinsale

Hi All,

Please be gentle with me as this is my 1st foray into Outlook VBA
programming although l am very profficient @ Excel VBA.

I have a distribution list of email address's in an Excel database.
When a mailshot is sent the receiver has the option to 'unsubscrbe' by
replying with 'unsubscribe' in the Subject box. Emails replied to in
this way are stored in a folder called 'UNSUBSCRIBERS'

What l would like to do is loop thru all the emails in the
'UNSUBSCRIBERS' folder and list the senders email address's in a
specific Excel workbook/ sheet. All the emails in the 'UNSUBSCRIBERS'
folder should then be deleted. For the purpose of sample code
(hopefully) lets call the workbook 'SALESBASE' and the worksheet
'TODELETE'

I would prefer to launch the code from the Excel workbook ( because l
know how / where to place the code etc) but if this is too difficult it
could be run from Outlokk providing someone is kind enough to tell me
where to place the code and run it.

Can anybody provide this code / point me in the right direction please?

All help gratefully received

Sorry for being longwinded.

Kind regards

Michael beckinsale
 
S

Sue Mosher [MVP-Outlook]

Basic building blocks:

1) To get a non-default folder, you need to walk the folder hierarchy using the Folders collections or use a function that does that for you. See http://www.outlookcode.com/d/code/getfolder.htm and, especially for public folders, http://www.outlookcode.com/codedetail.aspx?id=1164

The folder has an Items collection you can iterate with a down-counting For ... Next loop.

2) In Outlook 2003, you can use the MailItem.SenderEmailAddress, but note that it's subject to security prompts. See http://www.outlookcode.com/d/sec.htm .

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

3) Don't forget to add a reference in your Excel project to the Microsoft Outlook library.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
M

michael.beckinsale

Sue,

Thanks for the info.

It all looks a bit daunting but l will give it a go!

Regards

Michael beckinsale
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top