Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default import email from Outlook



Hi,

I receive everyday email with data...
I want to import this data into my excel sheet..


How can I do this?

Thanks for help!


Carl







  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default import email from Outlook

Charlie

Start here

www.dicks-clicks.com

and post back with more specific questions if you have them.

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"Charlie" wrote in message
...


Hi,

I receive everyday email with data...
I want to import this data into my excel sheet..


How can I do this?

Thanks for help!


Carl









  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default import email from Outlook

On Thu, 6 Nov 2003 12:27:18 -0600, "Dick Kusleika"
wrote:

Charlie

Start here

www.dicks-clicks.com

and post back with more specific questions if you have them.



Dick,

The "retrieving EMail" code worked great for me with XP.

How should I change the "olMail.ReceivedTime" in the line

ActiveSheet.Cells(i, 1).Value = olMail.ReceivedTime

to copy the whole body of the email.

TIA

Ron
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default import email from Outlook

Ron

ActiveSheet.Cells(i, 1).Value = olMail.Body

will copy the entire body of the email into that cell. I don't know if
there are limits on how much text you can bring over.

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"Ron" wrote in message
...
On Thu, 6 Nov 2003 12:27:18 -0600, "Dick Kusleika"
wrote:

Charlie

Start here

www.dicks-clicks.com

and post back with more specific questions if you have them.



Dick,

The "retrieving EMail" code worked great for me with XP.

How should I change the "olMail.ReceivedTime" in the line

ActiveSheet.Cells(i, 1).Value = olMail.ReceivedTime

to copy the whole body of the email.

TIA

Ron



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default import email from Outlook

Dick,




The email code also worked fine for me...

Except I want the email body not in 1 cell, but I want to have each
line of the body in a different row. Is that possible?

Thanks




"Dick Kusleika" wrote in message ...
Ron

ActiveSheet.Cells(i, 1).Value = olMail.Body

will copy the entire body of the email into that cell. I don't know if
there are limits on how much text you can bring over.

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"Ron" wrote in message
...
On Thu, 6 Nov 2003 12:27:18 -0600, "Dick Kusleika"
wrote:

Charlie

Start here

www.dicks-clicks.com

and post back with more specific questions if you have them.



Dick,

The "retrieving EMail" code worked great for me with XP.

How should I change the "olMail.ReceivedTime" in the line

ActiveSheet.Cells(i, 1).Value = olMail.ReceivedTime

to copy the whole body of the email.

TIA

Ron



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default import email from Outlook

charelke

The Body property is just a string, so you can manipulate it like any other
stirng. Here's an example

Sub emaillines()

Dim ol As Outlook.Application
Dim ns As Outlook.NameSpace
Dim fldr As Outlook.MAPIFolder
Dim mi As Outlook.MailItem
Dim stBody As String
Dim LineBreak As Long
Dim i As Long

Set ol = New Outlook.Application
Set ns = ol.GetNamespace("MAPI")
Set fldr = ns.GetDefaultFolder(olFolderInbox)
Set mi = fldr.Items(78)

stBody = mi.Body
LineBreak = 1
i = 1

Do
ActiveSheet.Cells(i, 1).Value = _
Mid(stBody, LineBreak, InStr(LineBreak, stBody, Chr(10)) -
LineBreak)
LineBreak = InStr(LineBreak + 1, stBody, Chr(10)) + 1
i = i + 1
Loop Until LineBreak = 0 Or LineBreak Len(stBody)

End Sub

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"charelke" wrote in message
om...
Dick,




The email code also worked fine for me...

Except I want the email body not in 1 cell, but I want to have each
line of the body in a different row. Is that possible?

Thanks




"Dick Kusleika" wrote in message

...
Ron

ActiveSheet.Cells(i, 1).Value = olMail.Body

will copy the entire body of the email into that cell. I don't know if
there are limits on how much text you can bring over.

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"Ron" wrote in message
...
On Thu, 6 Nov 2003 12:27:18 -0600, "Dick Kusleika"
wrote:

Charlie

Start here

www.dicks-clicks.com

and post back with more specific questions if you have them.


Dick,

The "retrieving EMail" code worked great for me with XP.

How should I change the "olMail.ReceivedTime" in the line

ActiveSheet.Cells(i, 1).Value = olMail.ReceivedTime

to copy the whole body of the email.

TIA

Ron



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default import email from Outlook

Dick,

In XP and with the body of the email in cell "AI" I tried the
"emaillines" sub but ran into "Run-time error '-2147352567
(80020009)':

Array index out of bounds."

How to fix please.

TIA

Ron

On Wed, 12 Nov 2003 08:13:28 -0600, "Dick Kusleika"
wrote:

charelke

The Body property is just a string, so you can manipulate it like any other
stirng. Here's an example

Sub emaillines()

Dim ol As Outlook.Application
Dim ns As Outlook.NameSpace
Dim fldr As Outlook.MAPIFolder
Dim mi As Outlook.MailItem
Dim stBody As String
Dim LineBreak As Long
Dim i As Long

Set ol = New Outlook.Application
Set ns = ol.GetNamespace("MAPI")
Set fldr = ns.GetDefaultFolder(olFolderInbox)
Set mi = fldr.Items(78)

stBody = mi.Body
LineBreak = 1
i = 1

Do
ActiveSheet.Cells(i, 1).Value = _
Mid(stBody, LineBreak, InStr(LineBreak, stBody, Chr(10)) -
LineBreak)
LineBreak = InStr(LineBreak + 1, stBody, Chr(10)) + 1
i = i + 1
Loop Until LineBreak = 0 Or LineBreak Len(stBody)

End Sub


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default import email from Outlook

Ron

On which line?

If it was this one

Set mi = fldr.Items(78)

then you may not have 78 emails in your inbox. You need to set mi equal to
the email that you want. For tips on this see

http://www.dicks-clicks.com/excel/olRetrieving.htm

This sub takes the body from the email and parses into lines on a sheet.
Having the body in A1, doesn't matter, because it's not taking the body from
the worksheet, rather, straight from the email.

Post back if that doesn't answer your question.

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"Ron" wrote in message
...
Dick,

In XP and with the body of the email in cell "AI" I tried the
"emaillines" sub but ran into "Run-time error '-2147352567
(80020009)':

Array index out of bounds."

How to fix please.

TIA

Ron

On Wed, 12 Nov 2003 08:13:28 -0600, "Dick Kusleika"
wrote:

charelke

The Body property is just a string, so you can manipulate it like any

other
stirng. Here's an example

Sub emaillines()

Dim ol As Outlook.Application
Dim ns As Outlook.NameSpace
Dim fldr As Outlook.MAPIFolder
Dim mi As Outlook.MailItem
Dim stBody As String
Dim LineBreak As Long
Dim i As Long

Set ol = New Outlook.Application
Set ns = ol.GetNamespace("MAPI")
Set fldr = ns.GetDefaultFolder(olFolderInbox)
Set mi = fldr.Items(78)

stBody = mi.Body
LineBreak = 1
i = 1

Do
ActiveSheet.Cells(i, 1).Value = _
Mid(stBody, LineBreak, InStr(LineBreak, stBody, Chr(10)) -
LineBreak)
LineBreak = InStr(LineBreak + 1, stBody, Chr(10)) + 1
i = i + 1
Loop Until LineBreak = 0 Or LineBreak Len(stBody)

End Sub




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
import email addresses into a outlook distribution list summer Excel Discussion (Misc queries) 3 December 11th 07 08:45 PM
Outlook Email Jame-O New Users to Excel 1 November 7th 06 05:53 PM
How do I import Outlook email into Excel, as object? Wizard Excel Discussion (Misc queries) 0 May 25th 06 11:27 PM
Import Email from Outlook into Worksheet Cillian Excel Discussion (Misc queries) 0 April 24th 06 03:37 PM
Email & Outlook Chris Excel Discussion (Misc queries) 0 March 14th 06 12:04 PM


All times are GMT +1. The time now is 12:35 PM.

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"