[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 223
  • Last Modified:

VBA for Outlook

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
jelen
Asked:
jelen
  • 2
1 Solution
 
bruintjeCommented:
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
 
jelenAuthor Commented:
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
 
bruintjeCommented:
thanks for the grade
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now