Making a macro run when the user closes a workbook

N

Nicke

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top