Code No Longer Runs After the Close Command

In Microsoft Excel 95, Visual Basic will run the code after a Close method is called from within the workbook being closed. The workbook is not really closed until execution of Visual Basic code ends.

In Microsoft Excel 97, execution of Visual Basic code ends with the execution of the Close method. Code that closes the workbook should be in a different workbook so that it can continue to run after it closes the file.

Sub CodeRunsAfterClose()
     ThisWorkbook.Close
     MsgBox "hi" ' This line will run in Microsoft Excel 95 but not in Microsoft Excel 97
End Sub