In Excel 2003/2007, in which cases should I use auto_open/auto_close routines, and in which cases should I use the workbook_open/workbook_beforeclose events instead?
Apart from backward compatibility to prehistoric versions of 开发者_运维问答Excel, the difference I'm aware of is that one is public and one is private. What (if any) are the other differences?
I spent a long time once choosing between the opening variants of these, and we used Auto_Open. The main rationale was because if anyone runs the following code:
Application.EnableEvents = False
... then the Workbook_Open event will not fire. I had a feeling there was another situation where Workbook_Open didn't work either, but I can't remember it now.
I don't have a strong opinion about the close events, but to be honest I'd use the Auto_Close there too. At the end of the day, it's had more testing.
精彩评论