LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Workbook_BeforeClose

Hello,

I am trying to use the beforeclose event on a workbook. However, it appears
to be getting bypassed everytime I close the book as I am being asked the
standard "Do you want to save the changes to...". Here is what I have written
for it.

Private Sub workbook_beforeclose(Cancel As Boolean)

Cancel = False


If Sheets("Check").Range("Protected") = "Y" Then
If bBlockEvents Then Exit Sub
ThisWorkbook.Saved = True
bBlockEvents = True

Else
If Range("Prepare") "" And Range("Checked") "" And Not Range
("Protected") = "Y" Then
Message = MsgBox("Is this workbook finished with for today?",
vbYesNo + vbCritical)
If Message = vbNo Then
Call DeleteEVMenu 'Sub to delete custom menu
Else
Sheets("Check").Range("Protected") = "Y"
ProtectSheets 'Sub to protect certain sheets
Call DeleteEVMenu 'Sub to delete custom menu
ThisWorkbook.Save
End If
End If
End If

End Sub

Any help would be much appreciated

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200606/1
 
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
Workbook_BeforeClose [email protected] Excel Programming 1 April 11th 06 10:53 AM
workbook_beforeClose GB Excel Programming 2 March 1st 06 12:39 AM
Workbook_BeforeClose Andrzej Excel Programming 1 June 12th 05 10:01 PM
Workbook_BeforeClose PO Excel Programming 2 January 30th 05 05:07 PM
Workbook_BeforeClose Don Guillett[_4_] Excel Programming 1 August 31st 04 02:27 PM


All times are GMT +1. The time now is 08:34 PM.

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"