View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Per Jessen Per Jessen is offline
external usenet poster
 
Posts: 1,533
Default Exiting a workbook

Hi Dave

Maybe you could use a Workbook_BeforeClose event to call your housekeeping
code if the user don't use your button.

As it's an event code it goes into the code sheet for ThisWorkbook.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call HouseKeeping
End Sub

Regards,
Per

"Risky Dave" skrev i meddelelsen
...
Hi all,

Nearly finished what for me is a fairly major piece of work and the last
thing I am doing is locking down the workbook so that users cannot
accidentally change anything they shouldn't.

So, under Vista on XL 2007, I have:
1) Password protected the VB work area (sorry - don't know what this is
correctly called). I am aware that XL password protection is not strong -
this doesn't matter as I am only protecting against casual/accidental
damage,
not a conscious malicious attack;
2) Disabled right-click mouse functionality;
3) Turned off the ribbon.

Two questions:
1) Is there anything else I should do to prevent accidental corruption of
data (system backups, duplication etc. is already taking place)?
2) I want to be able to hide the "x" button that exits MS applications so
that users are forced to leave the workbook using my own exit button (this
allows me to automatically do some housekeeping before the application
closes). Is there any way of doing this - switching off the ribbon does
not
seem to affect it?

TIA

Dave