[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
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
Medium Priority
?
402 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 2000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

By default Outlook 2016 displays only one time zone in the Calendar. The following article explains how to display two time zones in one calendar view.
Are you looking for the options available for exporting EDB files to PST? You may be confused as they are different in different Exchange versions. Here, I will discuss some options available.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

649 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