R
RosH
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
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