Any vba code to disable only close button in Excel workbook, please?
Hi,
You can use the BeforeClose event of the worrkbook using VBA:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If MsgBox("Are you sure", vbQuestion + vbYesNo, "Close the book") =
vbNo Then
Cancel = True
End If
End Sub
If you use it like this
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Cancel = True
End Sub
You will nevere be able to close the workboor or end Excel on a normal
way!
HTH
Executor
|