import value from outlook mail to excel spreadsheet
Can I import into an excel spreadsheet a value from an outlook received mail
message? |
import value from outlook mail to excel spreadsheet
What kind of mail ? HTML or plain text ?
Here's some code for looping through the items in the inbox: might get you started. Tim '***************** Option Explicit Sub CheckOutlookMsgs() Const S_SUBJECT As String = "YourSubjectHere" Dim olApp As Outlook.Application Dim fInbox As MAPIFolder Dim olInboxCollection As Object Dim olInboxItem As Object Dim iCount As Integer Dim itemCount, n On Error Resume Next Set olApp = GetObject(, "Outlook.Application") If olApp Is Nothing Then MsgBox "Outlook is not running: please open the application first" Err.Clear Exit Sub End If On Error GoTo haveError 'Get the inbox folder Set fInbox = olApp.GetNamespace("MAPI").GetDefaultFolder(olFold erInbox) Set olInboxCollection = fInbox.Items itemCount = olInboxCollection.Count iCount = 0 For n = itemCount To 1 Step -1 Set olInboxItem = olInboxCollection(n) If StrComp(olInboxItem.Subject, S_SUBJECT) = 0 Then iCount = iCount + 1 Application.StatusBar = "Processing # " & iCount 'here's where you get the info from the attachment.... MsgBox olInboxItem.Body End If Next n haveError: If Err < 0 Then MsgBox "Error:" & vbCrLf & Err.Description Application.StatusBar = False End Sub '***************** "Max Bialystock" wrote in message ... Can I import into an excel spreadsheet a value from an outlook received mail message? |
import value from outlook mail to excel spreadsheet
Thanks for that Tim, it's HTML.
Max "Tim Williams" <timjwilliams at gmail dot com wrote in message ... What kind of mail ? HTML or plain text ? Here's some code for looping through the items in the inbox: might get you started. Tim '***************** Option Explicit Sub CheckOutlookMsgs() Const S_SUBJECT As String = "YourSubjectHere" Dim olApp As Outlook.Application Dim fInbox As MAPIFolder Dim olInboxCollection As Object Dim olInboxItem As Object Dim iCount As Integer Dim itemCount, n On Error Resume Next Set olApp = GetObject(, "Outlook.Application") If olApp Is Nothing Then MsgBox "Outlook is not running: please open the application first" Err.Clear Exit Sub End If On Error GoTo haveError 'Get the inbox folder Set fInbox = olApp.GetNamespace("MAPI").GetDefaultFolder(olFold erInbox) Set olInboxCollection = fInbox.Items itemCount = olInboxCollection.Count iCount = 0 For n = itemCount To 1 Step -1 Set olInboxItem = olInboxCollection(n) If StrComp(olInboxItem.Subject, S_SUBJECT) = 0 Then iCount = iCount + 1 Application.StatusBar = "Processing # " & iCount 'here's where you get the info from the attachment.... MsgBox olInboxItem.Body End If Next n haveError: If Err < 0 Then MsgBox "Error:" & vbCrLf & Err.Description Application.StatusBar = False End Sub '***************** "Max Bialystock" wrote in message ... Can I import into an excel spreadsheet a value from an outlook received mail message? |
import value from outlook mail to excel spreadsheet
Then my example code should get you as far as having the messge content.
How you extract a particular value will depend on where it is in the mail. Tim "Max Bialystock" wrote in message ... Thanks for that Tim, it's HTML. Max "Tim Williams" <timjwilliams at gmail dot com wrote in message ... What kind of mail ? HTML or plain text ? Here's some code for looping through the items in the inbox: might get you started. Tim '***************** Option Explicit Sub CheckOutlookMsgs() Const S_SUBJECT As String = "YourSubjectHere" Dim olApp As Outlook.Application Dim fInbox As MAPIFolder Dim olInboxCollection As Object Dim olInboxItem As Object Dim iCount As Integer Dim itemCount, n On Error Resume Next Set olApp = GetObject(, "Outlook.Application") If olApp Is Nothing Then MsgBox "Outlook is not running: please open the application first" Err.Clear Exit Sub End If On Error GoTo haveError 'Get the inbox folder Set fInbox = olApp.GetNamespace("MAPI").GetDefaultFolder(olFold erInbox) Set olInboxCollection = fInbox.Items itemCount = olInboxCollection.Count iCount = 0 For n = itemCount To 1 Step -1 Set olInboxItem = olInboxCollection(n) If StrComp(olInboxItem.Subject, S_SUBJECT) = 0 Then iCount = iCount + 1 Application.StatusBar = "Processing # " & iCount 'here's where you get the info from the attachment.... MsgBox olInboxItem.Body End If Next n haveError: If Err < 0 Then MsgBox "Error:" & vbCrLf & Err.Description Application.StatusBar = False End Sub '***************** "Max Bialystock" wrote in message ... Can I import into an excel spreadsheet a value from an outlook received mail message? |
All times are GMT +1. The time now is 06:32 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com