Auto_Open or Workbook_Open? (Auto runnig a macro on file open)
Keep it simple:
Both Auto_Open and Workbook_Open are for running some code on the loading of a workbook. But they have some minor differences.
- the "old" startup macro before VB Editor existed and modules were in module sheets and forms were in dialog sheets. It's existence is therefore also for backward compatibility.
- Auto_Open is put in a module.
- If a workbook is opened with a macro, Auto_Open WON'T be fired.
- the "new" startup macro, since the existence of VB Editor.
- Workbook_Open is put inside "ThisWorkbook".
- If a workbook is opened with a macro, Workbook_Open WILL be fired.
Both macros will be disabled when you open a workbook while holding the Shift key on your keyboard.
Therefore, a most critical criteria to consider when one to be used is : do you want the macro to be fired when the workbook is opened with a macro.
(e.g. Workbooks.Open <file_path> )