As we have observed, the Workbooks.Open
method does not trigger the Auto_Open
event, so putting a breakpoint within the 'controlling' workbook, after the new workbook is opened, will not allow you to enter and debug code as you may need to do.
One workaround would be to insert a line of code with a breakpoint that manually calls the Auto_Open
procedure. This should allow you to debug code in each of the books that are opened:
Sub test()
Dim wb As Workbook
Set wb = Workbooks.Open("C:\path_to\your_file.xlsm")
Application.Run wb.Name & "!Auto_Open" '// PUT BREAKPOINT HERE!
End Sub
Alternatively, as suggested HERE, port the code from the Auto_Open
event to the Workbook_Open
event.
I should have thought of that sooner... I have only ever used Auto_Open
with XLA/XLAM Add-In files, never with an ordinary workbook file where the Workbook_Open
event should suffice.