Does anyone know how to get Excel VBA to distiguish between a workbook being opened automatically versus a workbook being opened by a user? I have set Windows Scheduler to open a workbook when a certain user logs on to the computer. When opened, this workbook automatically runs some code. Sometimes, this user will want to open the workbook himself. When he does this, I want the workbook to run different code. Is there an object or method I can use to tell the code the difference? Basically, I'd like the workbook to automatically close when it was automatically opened, and not automatically close when the user opened the book himself.

I appreciate anyone's insight into solving this problem.