MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Integrating Outlook with Excel

  Asked By: Colleen    Date: Mar 03    Category: MS Office    Views: 3398

Is it possible to integrate outlook with Excel for certain actions?

For example, if I have created an evening in Outlook and sent mails to
people for accepting/rejecting. When these people open their mails, and take
action (accept/reject), can the results be automatically stored in an excel
sheet residing somewhere?



2 Answers Found

Answer #1    Answered By: Faiza Mian     Answered On: Mar 03

You could certainly write code - in Outlook - to process incoming messages.
This code could write things to an Excel file.

Trying to do the processing from the Excel end would be possible, but
probably a lot harder.

I haven't written Outlook code, and don't know its peculiarities (aka object
model), but it's got VBA just like Excel has. I don't know if there are any
Outlook programming groups. You could start with the Office group, MSO -

Answer #2    Answered By: Felix Gray     Answered 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

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
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
' set the above to the relevant folder names AND the below to the relevant
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

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