Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto_Close Macro

Status
Not open for further replies.

dar149

MIS
Mar 5, 2002
117
US
I have several subprocedures that run from the Auto_Close macro when a file is closed. I have a message box that pops up as soon as Auto_close starts that asks if they are sure they want to close. If they say no, I would like to stop all subprocedures, which I am able to do. But I would also like to leave the spreadsheet open. Is there a way to stop all subprocedures from running and leave the spreadsheet open after the auto_close macro has started?
 
Try adding this to you ThisWorkBook module


Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim UserPrompt As Long
UserPrompt = MsgBox("Quit ?", vbQuestion + vbYesNo, "QUIT ?")
If UserPrompt = vbNo Then
Cancel = True
End
End If
End Sub

hope it helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top