I am trying to create some code in VBA that will automatically take all emails that enter an inbox and automatically move the emails and some meaningful information about them into an excel spreadsheet log. Each month's emails will be in a different sheet. I discovered I can use the Item Add event in the ThisOutlookSession module. The problem is this only works once, at which point I have to close out of vba and Outlook 2010 and reopen for it to work again. I think this is because at the end of
I am using End to exit the script as shown below:Please Login or Register to view this content.
I suspect End might be causing an inability for me to re-enter the ItemAdd event. The problem is if I don't use End my code doesn't work at all and I think it has something to do with the workbook, worksheet, wks, and wkb references displaying method sheets of object _global failed when I try and debug the code. I feel my two choices are to keep using End or find some other way to (assuming this is why End has been working) release all the memory that allows me to keep re-using the script OR figure out if the method sheets of object _global failed is related and what I need to do to fix this. My question is what seems to be causing these issues and as a new VBA rookie what do I explicitly need to do to fix it?Please Login or Register to view this content.
Thank you for the help and here is most of my Code that is relevant
Please Login or Register to view this content.
Bookmarks