I have found code to prevent closure of an application by clicking on
the Red X. I placed it on Thisworkbook & it prevents the user from
closing by clicking on the Red X.
Here is the code as written at present:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If CloseMode = 0 Then
Cancel = True
MsgBox "The X is disabled, please click on the Exit button.",
vbCritical
End If
End Sub
This code is also preventing closure of the workbook/application. I
think that once the code runs it is not released, I have not found a
solution.
I see the code working this way. The user clicks on the X & the above
message, pops up & that is the end of the process. The user clicks on
Exit & it closes. I do have working code to close the
workbook/application. However when the Exit button is clicked at present
it goes back to the above code.
Why not just redirect to Call the process fired by the Exit button -OR- Call
Exit button's _Click event so any closing forces your Exit button procedure to
run???
--
Garry
Free usenet access at
http://www.eternal-september.org
Classic
VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.
vb.general.discussion