PDA

View Full Version : Monitor for incoming emails matching pattern



bigal.nz
03-16-2016, 10:09 PM
Hi all,

I work within a very prescribed and restricted enterprise enviroment. Having said that I need a way to get information from a email into MS Access database.

My current plan is to use a VBA script that Autostarts with outlook and scans unread emails for a pattern, probably something like from johnsmith@companyxyz.com or janedoe@companyabc.com AND subject line has instr 10 string record number matching Pxxxxxxxxx where x is a digit.

It would then take scan the body of the email for COMMENT and perhaps read in everything until it reaches the end string (perhaps *** for end string?)

Now at this point the VBA would either write the string into database.accdb table:test where record number = record number from email subject

And IF a matching record is found update the COMMENTS field of that record with the text string found between COMMENT and ***

Phew!!

Anyone who might be able to help with some code for this please or has a better idea I would love to hear it.

Cheers in advance

-Al
PS: I could so some of this in java, but if it can all be done in VBA I dont see the point in using Java.