VBA Lesson 14: VBA for Excel for WorkbooksThis is an excerpt from Pierre Leclerc (www.excel-vba.com) To develop a VBA procedure that is triggered by an event relating to the workbook (when you open it, when you save it, when you close it) see the VBA lesson on events. ThisWorkbook ThisWorkbook is the workbook within which your VBA procedure runs. So if you write: If you want to close the workbook within which your VBA procedure (macro) runs without saving it you will write these two lines of code: Workbooks and Windows When you work with two workbooks you will move from one to the other with: Go to the next lesson |