Re: Copying body text from email to word doc
- From: "Steve Yandl" <syandl_nospam@xxxxxxxxxxx>
- Date: Mon, 29 Oct 2007 16:26:56 -0700
Paul,
The sub below will look in a subfolder of the Inbox named "Jokes" and
extract those messages received since the start of the current day and type
the bodies of those messages into the current active document with a new
paragraph started between each text body. If your folder of interest is at
the same level as the Inbox rather than being a subfolder, you will need a
slight modification. Note that when you run this subroutine, you will get a
security warning asking for permission to let the routine extract info from
Outlook for a period of 1 minute (or you can select a longer time period)
___________________________________
Sub CollectMsgBodies()
Const olFolderInbox = 6
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objFolderIN = objNamespace.GetDefaultFolder(olFolderInbox)
Set objFolder = objFolderIN.Folders("Jokes")
dtmTargetDate = Date
Set colItems = objFolder.Items
Set colFilteredItems = colItems.Restrict("[ReceivedTime] > '" &
dtmTargetDate & "'")
For I = 1 To colFilteredItems.Count
Selection.TypeText colFilteredItems(I).Body
Selection.TypeParagraph
Next I
End Sub
__________________________________
Steve
"Paul" <paul@xxxxxxxxxxxxxxxxxxx> wrote in message
news:%23kdjfZmGIHA.1212@xxxxxxxxxxxxxxxxxxxxxxx
Hi
I am trying to resuscitate some lost code someone wrote a few years back.
Basically, a colleague receives between 50 and 250 emails with specific
information in them which all go (or are copied) into a specific outlook
folder. I need to be able to extract the body text (only) of all messages
in this folder received each day and copy this text into one word document
for the day
Can anyone help or point me in the right direction?
many thanks in advance
Paul
--
Paul at preeve dot plus dot com
.
- Follow-Ups:
- Re: Copying body text from email to word doc
- From: Steve Yandl
- Re: Copying body text from email to word doc
- References:
- Copying body text from email to word doc
- From: Paul
- Copying body text from email to word doc
- Prev by Date: Re: VBA Error after installing Microsoft Accounting
- Next by Date: Re: Copying body text from email to word doc
- Previous by thread: Copying body text from email to word doc
- Next by thread: Re: Copying body text from email to word doc
- Index(es):
Relevant Pages
|