Hi
I want to read , extract and save body text messagges from outlook each time that I recive them. I want to save this messagges in csv logs.
My initial programm, it has an error.
Public Sub ReadEmails()
Dim olApp As Outlook.Application
Dim olNamespace As Outlook.NameSpace
Dim olFolder As Outlook.MAPIFolder
Dim SolFolder As Outlook.MAPIFolder
Dim olMail As Outlook.MailItem
Dim lngRow As Long
Dim Sbody
Set olApp = New Outlook.Application
Set olNamespace = olApp.GetNamespace("MAPI")
Set olFolder = olNamespace.Folders("Carpetas personales")
Set SolFolder = olFolder.Folders("linea922010")
lngRow = 1
For Each olMail In SolFolder.Items
With ActiveSheet
.Cells(lngRow, 1) = olMail.SenderName ####error object ?????
.Cells(lngRow, 2) = olMail.Subject
.Cells(lngRow, 3) = olMail.Body
lngRow = lngRow + 1
' Sbody = olMail.Body
' MsgBox Sbody
End With
Next
Set olMail = Nothing
Set olFolder = Nothing
Set SolFolder = Nothing
Set olNamespace = Nothing
Set olApp = Nothing
End Sub
Any suggestions
Thanks
Malpa
I want to read , extract and save body text messagges from outlook each time that I recive them. I want to save this messagges in csv logs.
My initial programm, it has an error.
Public Sub ReadEmails()
Dim olApp As Outlook.Application
Dim olNamespace As Outlook.NameSpace
Dim olFolder As Outlook.MAPIFolder
Dim SolFolder As Outlook.MAPIFolder
Dim olMail As Outlook.MailItem
Dim lngRow As Long
Dim Sbody
Set olApp = New Outlook.Application
Set olNamespace = olApp.GetNamespace("MAPI")
Set olFolder = olNamespace.Folders("Carpetas personales")
Set SolFolder = olFolder.Folders("linea922010")
lngRow = 1
For Each olMail In SolFolder.Items
With ActiveSheet
.Cells(lngRow, 1) = olMail.SenderName ####error object ?????
.Cells(lngRow, 2) = olMail.Subject
.Cells(lngRow, 3) = olMail.Body
lngRow = lngRow + 1
' Sbody = olMail.Body
' MsgBox Sbody
End With
Next
Set olMail = Nothing
Set olFolder = Nothing
Set SolFolder = Nothing
Set olNamespace = Nothing
Set olApp = Nothing
End Sub
Any suggestions
Thanks
Malpa