Trying to get BODY from open Outlook 2016 message into Access database

VBRosie

New Member
Joined
May 25, 2017
Messages
7
I am trying to setup a mechanism,
where we take a currently open email message in Outlook 2016, that has some info
in the BODY of the message (First Name, Last Name, Address, Phone). Then, take
that body and process it and put it into some fields in an access database. We
are just trying to figure out the lines of code to fill a variable in VBA with
the contents of an open Outlook 2016 email message, by clicking a button in
Access 2016.

here is the code that we currently have from 2010 to try to get the body.

Any thoughts?

strEmailbody = ActiveInspector.CurrentItem.Body

Error message is a runtime error 287
 
is the email in your local mailbox or is it in a shared mailbox - if it is shared, can you copy one into your personal mailbox and retry? Could be a security issue.
 
Upvote 0

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
It's a shared mailbox. I tried copying the email form into my personal mailbox and got same error message.
 
Upvote 0
A quick google search of the second error you got throws up a lot of similar problems that tie back to Outlook security.... Given that you have just updated to 2016 it may be that one of the security settings within outlook or set by your sys admin is disabling programmatic access to the body of the email (as if it was access you would have got the error when trying to read the subject of the email).

Without knowing your exact security settings its hard to be anymore specific.
 
Upvote 0
merely a guess but try:

Code:
strEmailbody = ActiveInspector.CurrentItem.HTMLBody
msgbox strEmailbody

if that gives you anything that works then the problem is the emails are not plain text but html.
 
Upvote 0
Xenou,

I changed the code and got the Run-time error '287: Application-defined or object-define error.
 
Upvote 0

Forum statistics

Threads
1,221,692
Messages
6,161,327
Members
451,697
Latest member
pedroDH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top