Solved

VBA for Outlook

Posted on 2002-03-19
3
210 Views
Last Modified: 2008-03-06
For every message in my Outlook "XYZ" folder of incoming items, I want to collect the following information:
a) date sent
b) E-mail address
c) Subject Line
d) Icon (replied, forwarded or nothing)

if (d) is replied or forwarded, then I would like to find the reply in my Sent Items folder and capture
e) date of reply/forward
f) text of reply/forward
g) time spent editing reply/forward would be a huge plus

The output would go to Access or Excel or a text file or whatever.  I can handle writing the output.

I explored around the Outlook object model today, but couldn't even manage to loop through each mailitem in the CurrentFolder.  I really got stopped when trying to find the replies - didn't seem to be any property even remotely related to that.

No need for complete answers - even if you have some piece of this answer, that would be great.

Bill


0
Comment
Question by:jelen
  • 2
3 Comments
 
LVL 44

Accepted Solution

by:
bruintje earned 100 total points
Comment Utility
Hi Bill,

Then i think you'll find what you at teh slipstick site

http://www.slipstick.com/dev/code/getsenderaddy.htm
http://www.slipstick.com/dev/vb.htm

and to round it up a more general page with links on how to program in outlook, but first check ou the lsipstick site there wil be samples on everythign you need like the first link shows

http://www.outlookexchange.com/articles/home/outlooklinks.asp

HTH:O)Bruintje

0
 
LVL 1

Author Comment

by:jelen
Comment Utility
Bruntje,

Thanks for the links.  In case anyone ever buys the question in the future, here is the VBA which I built from those links:

Public Sub InboxSendDates()

    Dim objNameSpace As NameSpace
    Dim objMAPIFolder As MAPIFolder
    Dim objMailItem As MailItem
    Dim lngOldMailCounter As Long
    Dim lngNewMailCounter As Long
    Dim oExcel As Object
       
    Set oExcel = CreateObject("Excel.Application")
    oExcel.Workbooks.Add
    Dim WB As Workbook
    Set WB = oExcel.ActiveWorkbook
    Dim WS As Worksheet
    Set WS = WB.ActiveSheet
    Ctr = 1
    oExcel.Visible = True
       
    Set objNameSpace = GetNamespace(Type:="MAPI")
    Set objMAPIFolder = _
          objNameSpace.Folders("Personal Folders").Folders("Sent Items")
          'objNameSpace.Folders("Personal Folders").Folders("Ask MrExcel").Folders("Quotes")
   
    For Each objMailItem In objMAPIFolder.Items
        Ctr = Ctr + 1
        If Ctr > 1717 Then
            MyCtr = Ctr - 1717
            On Error Resume Next
             WS.Cells(MyCtr, 1).Resize(1, 9).Value = Array( _
                objMailItem.SenderName, _
                objMailItem.SentOn, _
                objMailItem.Subject, _
                objMailItem.To, _
                objMailItem.CreationTime, _
                objMailItem.MessageClass, _
                objMailItem.ConversationTopic, _
                objMailItem.ConversationIndex, _
                objMailItem.Body _
                )
            On Error GoTo 0
        End If
   
    Next objMailItem
   
       
End Sub

Bill
0
 
LVL 44

Expert Comment

by:bruintje
Comment Utility
thanks for the grade
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Outlook Free & Paid Tools
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …

728 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now