Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 2010 > Visual Basic 2010 General Discussion
| Search | Today's Posts | Mark Forums Read
Visual Basic 2010 General Discussion For any discussions about Visual Basic 2010 topics which aren't related to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2010 General Discussion section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old July 25th, 2018, 10:00 PM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2018
Location: Altamont, NY
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Access the body of Outlook E-mail through VBA

Hi everyone,

I am using MS office 2010 (MS Outlook) and Windows 7 Ultimate. I am trying to obtain information from certain E-mails when they are received to update an Access database. I used the following code to obtain the subject, E-mail address and received time. However the body fields were empty.
<Code>
Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
Dim strSQL As String
Dim MyMail As MailItem
Set MyMail = Application.Session.GetItemFromID(EntryIDCollectio n)
Dim MySubject As String
Dim MySender As String
Dim MyTime As Date
Dim MyBody As String
MySubject = MyMail.Subject
MySender = MyMail.SenderEmailAddress
MyTime = MyMail.ReceivedTime
MyBody = MyMail.Body
.
.
.
<CODE/>

I've also tried obtaining info from the Outlook.Mailitem object but it does not point to the current E-mail.

Is there any VBA code that shows how to retrieve the body from an incoming E-mail that was just received?

Thanks,
Carl


Similar Threads
Thread Thread Starter Forum Replies Last Post
get perticular data from outlook mail into excel using VBA kulkasac Excel VBA 3 January 23rd, 2009 05:05 AM
E-mail using VBA and Outlook cc16 Access VBA 6 December 4th, 2006 11:07 AM
Receiving mail with Outlook 2000 VBA spotts-71 All Other Wrox Books 3 August 24th, 2004 10:41 AM
Receiving mail with Outlook 2000 VBA spotts-71 Pro VB 6 7 July 17th, 2003 03:04 PM
Outlook 2000 VBA - Receive mail... spotts-71 VB How-To 2 July 17th, 2003 02:56 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.