This week I experienced that joy you have when you finally unpick something you’ve been trying to crack for ages. I’m so glad I kept persevering with it!
As part of a beta test for a database I have now launched, some feedback was given that I could auto fill information from emails to complete the database entry, rather than allow the user to manually provide the information and then upload the email. It’s great to work with creative people that come up with new ideas. However, this idea was a very hard nut to crack. Most of the material online is about creating emails, rather than reading emails. But eventually, after lots of reading and trawling, I managed to find the commands that meant I could read these emails.
Dim myOlApp As New Outlook.Application
Dim myItem As Object
Set myItem = myOlApp.ActiveInspector.currentItem
The third line, ActiveInspector.CurrentItem works if the user has one email open in it’s own window, then you can use “With myItem” and it’s parameters (Subject, To, MessageBody….) to get the data from the email!
There’s still a couple of things left to understand surrounding this problem:
- How do I export/import the email from the outlook .ost file to the folder I’m storing it in the database?
- What pop ups or displays do I need to make sure the staff open the right emails?