I have written some VBA that is triggered when an email comes into the Inbox (outlook 2000). The VBA connects to a DB, finds some information, then responds to the email with that information. That email is then moved to a different folder in Outlook. Then, I have query that checks the Inbox to see if there are more emails. if there is one, a variable grabs the top record (the first email in the Inbox), and assigns it to an Object variable.
olInboxItems_ItemAdd(ByVal Item As Object)
seems to not want to let me call it again and pass the next email to it. I am trying to figure out how to get the VBA to cycle through the emails of there are more in the inbox.
This is where I query the inbox, assign the next email to the variable, and pass it through... all i keep getting is "Object required" Error no matter what i try:
objNS2 is a Namespace
myFolder is a MAPIFolder
tempItem is an Object
Set objNS2 = Application.GetNamespace("MAPI")
Set myFolder = objNS2.GetDefaultFolder(olFolderInbox)
'assign the next email to tempItem
Set tempItem = myFolder.Items(1)
'pass tempItem to the original function to start the process again with a new email
I AM DESPERATE!!!!!! Can you help?
Thank you SOOOOOOOOOOO much for your help!
PS... the few times it accepted something, it simply used the original email and never picked up the new one... then after two more lines, it crashed. hope this doesnt confuse!