VBA - automatically run when any workbook is opened
excel, vba
Solution
As per the comment from Masoud, this is a great article. You can find all the detail there, but simply, this is all you need:
Private WithEvents App As Application
Private Sub Workbook_Open()
Set App = Application
End Sub
Private Sub App_NewWorkbook(ByVal Wb As Workbook)
MsgBox "New Workbook: " & Wb.Name
End Sub
Place the code into your ThisWorkbook module.
Problem
I want a Sub in my PERSONAL.XLAM file to run every time any workbook is opened. The following works, but only when opening a workbook when no other workbook is open. ``` Private Sub Workbook_Open() MsgBox "Hello." End Sub ``` How can I make this work upon opening additional workbooks?