Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Colleen Burton   on Mar 03 In MS Office Category.

  
Question Answered By: Felix Gray   on Mar 03

Here is a link to what you are looking for. It relates to export to Access
but since it is using ADO it should be simple to convert to Excel
http://blogs.techrepublic.com.com/howdoi/?p=119

In my opinion it may be easier to run in asynchronous (batch) mode and use
Excel to read Outlook and extract all new message information.
To simplify, you can create a rule in Outlook to move (or copy) all messages
(based on recognizable criteria) to a unique folder. Then in Excel scan that
folder and look for all items since the last scan - or move processed ones.
After successful process store the latest item's received date-time
information to know where to start next time.
Here is something I put together and tested to start you off - enjoy.

Option Explicit
Sub ReadOutlook()
Dim theRow As Integer, theColumn As Integer
Dim myNameSpace As Variant
Dim xx As Variant
Dim allFolders As Variant
Dim aFolder As Variant
Dim anItem As Variant

' this works for early binding - just for simplicity - but late would be
better
Dim myOlApp As Outlook.Application

Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set allFolders = myNameSpace.Folders


theColumn = 1
theRow = 2 ' I assumed 2 as 1 would be a header row, but it should be the _
next free row in your Excel Datasheet

For Each anItem In allFolders.Item("Personal Folders").Folders("Sent
Items").Items
' set the above to the relevant folder names AND the below to the relevant
subject
If anItem.Subject = "try this" Then
Cells(theRow, theColumn) = anItem.SenderName
Cells(theRow, theColumn + 1) = anItem.Subject
Cells(theRow, theColumn + 2) = anItem.Body
theRow = theRow + 1
End If
Next anItem

Set myOlApp = Nothing
Set myNameSpace = Nothing
Set allFolders = Nothing


End Sub

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Integrating Outlook with Excel Or get search suggestion and latest updates.


Tagged: