ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Making a macro run when the user closes a workbook (https://www.excelbanter.com/excel-programming/283752-making-macro-run-when-user-closes-workbook.html)

Nicke[_4_]

Making a macro run when the user closes a workbook
 
Yes it is, put the macro Workbook_BeforeClose.

Private Sub Workbook_BeforeClose(Cancel As Boolean)

Dim Answ As Integer

Answ = MsgBox("OK to close?", vbYesNo)

If Answ = vbNo Then
Cancel = True
End If

End Sub


-----Original Message-----
Is there any way I can get a macro to run automatically
everytime a user closes down the workbook?

Many thanks

KD
.



All times are GMT +1. The time now is 06:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com