Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 989
Default Prevent a workbook being closed with the X

I am using Excel 97. Is there anyway that you can prevent users on a
workbook from closing the workbook with the 'X' in the top right hand corner?

Thanks
--
Mark
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Prevent a workbook being closed with the X

In the "thisworkbook" module add a BeforeClose event something like this

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Cancel = True
MsgBox "This is not how you close this workbook..."
End Sub

Then in the close button or however you intend to close the workbook add in an
Application.enableevents = false to keep this code from firing when you
really want to clost the book. (Just as a note I usually try to avoid doing
things like this because the users find it fraustrating when they can't close
a program through normal windows functions. They start doing things like
hitting the power button or going into the task manager and ending things)
--
HTH...

Jim Thomlinson


"Mark" wrote:

I am using Excel 97. Is there anyway that you can prevent users on a
workbook from closing the workbook with the 'X' in the top right hand corner?

Thanks
--
Mark

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Value from a closed workbook Anthony Slater Excel Discussion (Misc queries) 5 May 17th 05 09:49 AM
copy from closed workbook again! ;( Christy Excel Programming 6 March 4th 05 10:33 PM
copy worksheet from closed workbook to active workbook using vba mango Excel Worksheet Functions 6 December 9th 04 07:55 AM
Getting value from closed workbook Dyawlak Excel Programming 1 April 22nd 04 02:20 AM
Accessing Closed Workbook Loomah Excel Programming 2 January 28th 04 12:11 PM


All times are GMT +1. The time now is 02:24 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"