Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 2010 > Visual Basic 2010 General Discussion
Password Reminder
| FAQ | Members List | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #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.
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

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?

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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

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

All times are GMT -4. The time now is 05:56 AM.

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