Solved

VBA for Outlook

Posted on 2002-03-19
3
214 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
[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
3 Comments
 
LVL 44

Accepted Solution

by:
bruintje earned 100 total points
ID: 6881746
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
ID: 6899278
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
ID: 6899817
thanks for the grade
0

Featured Post

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

690 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