To have the VBA Editor automatically open when Excel starts, add the code below to the ThisWorkbook module:
Private Sub Workbook_Open() Application.VBE.MainWindow.Visible = True Application.VBE.Windows("Immediate").Visible = True ThisWorkbook.VBProject.VBComponents("Module1").Activate End Sub
Double-click ThisWorkbook and select Workbook in the left drop-down. The Open declaration should initiate and populate the first and last lines of a Workbook_Open procedure for you.
Then simply add the code above.
This is exceptionally handy when you’re working on a project for several days, or when you want the end user to be able to view the editor (for example, to watch the action happen in the Immediate Window while the bot is running).