Solved

How do I write a macro to automatically process the subject heading of specific email addresses and paste these subjects into a text file?

Posted on 2003-11-19
2
396 Views
Last Modified: 2010-04-08
Hi Experts,

How do I write a macro to automatically process the subject heading of specific email addresses and paste these subjects into a text file?

The macro has to initiate upon receiving emails, check to see if the email is from  a specific email address and if it is, read the subject of the email into a text file.

Thanks!
0
Comment
Question by:indyng
2 Comments
 
LVL 4

Accepted Solution

by:
JeremyCrouch earned 500 total points
ID: 9782326
Private Sub Application_NewMail()  '<-- this must be in the 'ThisOutlookSession'
writeSubject                                 '<-- in the Microsoft Objects Project Folder
End Sub                                       '<--

Public Sub writeSubject()
Dim ns As NameSpace
Dim Inbox As MAPIFolder
Dim message As MailItem
Dim filename As String

Set ns = GetNamespace("MAPI")
Set Inbox = ns.GetDefaultFolder(olFolderInbox)

Set message = Inbox.Items(1)

If message.SenderName = "Crouch, Jeremy" Then  '<-- causes a security warning ;(
 filename = "C:\" & message.SenderName & "_Subjects.txt"  'or whatever
 Open filename For Append As #1
 Print #1, message.subject
 Close #1
End If
End Sub

This works however... and this is a big however. Due to recent security patches from microsoft anytime your try to get the sender of an email, a security warning pops up. That defeats the whole purpose of making this automatic. I've ran into this problem before and never found a way aroung this.

Sorry, but maybe the code is still usefull to you.
0
 
LVL 1

Author Comment

by:indyng
ID: 9782919
Great stuff! Thanks for the help!
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you unable to connect or configure Hotmail email account in Microsoft Outlook 2010, 2007? Or Outlook.com emails are not downloading to Outlook? Lets’ see the problem and resolve Outlook Connector error syncing folder hierarchy (0x8004102A).
This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question