Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default import value from outlook mail to excel spreadsheet

Can I import into an excel spreadsheet a value from an outlook received mail
message?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default 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?



  #3   Report Post  
Posted to microsoft.public.excel.programming
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?




  #4   Report Post  
Posted to microsoft.public.excel.programming
Tim Tim is offline
external usenet poster
 
Posts: 145
Default 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?






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you embed an Outlook e-mail into Excel Spreadsheet? J. Sheppard Excel Discussion (Misc queries) 0 April 25th 06 04:46 PM
can I import the outlook contacts into the excel spreadsheet? HOW [email protected] New Users to Excel 1 October 30th 05 05:24 AM
How can I use Outlook express to send mail rather than Outlook by VBA code new.microsoft.com Excel Programming 1 August 1st 05 12:45 PM
Import data from a Outlook mail in excel Stift Excel Programming 4 May 7th 04 08:50 AM
Display mail application either in Outlook, or Outlook express [email protected] Excel Programming 0 April 13th 04 09:50 PM


All times are GMT +1. The time now is 05:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"