ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Outlook express email reader (https://www.excelbanter.com/excel-programming/348060-outlook-express-email-reader.html)

RosH

Outlook express email reader
 
Hi Everyone,
I think of a macro which will be able to read all my email messages
and check for a specific string in any message and copy the 'from'
address to the excel sheet. I use Outlook express as the default email
program. I have obtained the following code from a website, but it
works only on Outlook. Anybody help me to do the same in outlook
express. Please also tell me which references i would have to include
in VB editor. Thanks in advance.

Sub GetFromInbox()

Dim olApp As Outlook.Application
Dim olNs As NameSpace
Dim Fldr As MAPIFolder
Dim olMail As Variant
Dim i As Integer

Set olApp = New Outlook.Application
Set olNs = olApp.GetNamespace("MAPI")
Set Fldr = olNs.GetDefaultFolder(olFolderInbox)
i = 1

For Each olMail In Fldr.Items
If InStr(olMail.Body, "ozark") 0 Or _
InStr(olMail.Subject, "ozark") 0 Then

ActiveSheet.Cells(i, 1).Value = olMail.ReceivedTime
i = i + 1
End If
Next olMail

Set Fldr = Nothing
Set olNs = Nothing
Set olApp = Nothing

End Sub


keepITcool

Outlook express email reader
 

you cant automate OutlookExpress with VBA

--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


RosH wrote :

Hi Everyone,
I think of a macro which will be able to read all my email messages
and check for a specific string in any message and copy the 'from'
address to the excel sheet. I use Outlook express as the default
email program. I have obtained the following code from a website,
but it works only on Outlook. Anybody help me to do the same in
outlook express. Please also tell me which references i would have
to include in VB editor. Thanks in advance.



All times are GMT +1. The time now is 11:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com