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
398 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

What does UTC stand for?  “Coordinated Universal Time” – Think of this as the true time on Planet Earth that never changes with the exception of minor leap seconds here and there to account for the changes in the planet's rotation.   What does th…
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 …
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

735 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