I want to process incoming mails.
My code has a lengthy conditional statement, to determine the category to which each incoming email belongs.
Based on the result of this conditional statement, the code is supposed to read the appropriate property of the MailItem object.
I want to use CallByName function to achieve this.
x = CallByName(itm, PAN_Source, VbGet)
Where 'itm' is the MailItem Object, 'PAN_Source' variable contains the string, which refers to the specific property from 'itm'.
For example, if an incoming mail has an attachment, then 'PAN_Source' is given the value "Attachments.Item(1).DisplayName". I want CallByName(itm, PAN_Source, VbGet) to return itm.Attachments.Item(1).DisplayName
The code just stops execution at this stage.
The CallByName function accepts the following arguments:
I'd try to use the following instead:
Call CallByName("itm", PAN_Source, VbGet)
You may find the Getting Started with VBA in Outlook 2010 article helpful.