Try declaring "emailItem" as "Object" instead of "emailItem1", "emailItem2", etc. Also, ensure Outlook is properly set up. Btw, when I was streamlining processes for my startup, I found Software development for startups really handy. They helped me tailor solutions like this.