Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Can I import into an excel spreadsheet a value from an outlook received mail
message? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do you embed an Outlook e-mail into Excel Spreadsheet? | Excel Discussion (Misc queries) | |||
can I import the outlook contacts into the excel spreadsheet? HOW | New Users to Excel | |||
How can I use Outlook express to send mail rather than Outlook by VBA code | Excel Programming | |||
Import data from a Outlook mail in excel | Excel Programming | |||
Display mail application either in Outlook, or Outlook express | Excel Programming |