View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Max Bialystock[_2_] Max Bialystock[_2_] is offline
external usenet poster
 
Posts: 31
Default 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?