Sorry, complete noob here... we have a client that has a list in Excel of 1,500 customers with their Customer ID and their email address.
As an invoice email comes into a mailbox they want a way to search the email body for the Customer ID and then forward to the email address in the Excel spreadsheet.
It doesn't have to be Excel, but it has to be simple enough for an end user to add to the list in the future.
Can this be done with VBA to search a database from Outlook, or do I need to look at a third party program? If the latter, can anyone recommend one?
CodePudding user response:
Yes, it is possible to implement such things according to your needs. You can create a VBA macro or develop a COM add-in if you need to distribute the solution on multiple machines. In case of VBA the starting point is to get familiar with the environment, see Getting started with VBA in Office.
You need to start from handling incoming emails, so the Application.NewMailEx can be helpful in that case. This event fires once for every received item that is processed by Microsoft Outlook. The item can be one of several different item types, for example, MailItem
, MeetingItem
, or SharingItem
. The NewMailEx
event fires when a new message arrives in the Inbox and before client rule processing occurs. The EntryIDsCollection
string contains the Entry ID that corresponds to that item. Use the Entry ID to call the NameSpace.GetItemFromID method and process the item.