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: 17
Default Workbook_BeforeClose event is not canceled

Hi,

I'm developing an Office COM Add-in by using Visual C# .NET.

The purpose of the add-in is to prevent any open workbook to get closed.
To achieve this I've implemented the following handler for the
Workbook_BeforeClose event of the Excel.Application object.

private void Connect_WorkbookBeforeClose(Excel.Workbook Wb, ref bool Cancel)
{
System.Windows.Forms.MessageBox.Show("It's not allowed closing the
workbook!");
Cancel = true;
}

At runtime, closing a workbook it pops up the message AND CLOSES the
workbook. The even is not canceled.

Am I missing anything?

Thanks,
Mircea



 
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
WorkbookBeforeClose event is not canceled Mircea Pleteriu[_2_] Excel Programming 1 June 3rd 05 04:22 AM
Detecting a cancel on Workbook_BeforeClose event? Don Wiss Excel Programming 3 January 18th 05 12:49 PM
Run Macro If Save Is Canceled On SaveAs Window In VBA Celtic_Avenger[_42_] Excel Programming 0 September 19th 04 09:30 AM
Workbook_Beforeclose vs BeforeClose Event Juan Pablo González Excel Programming 3 February 2nd 04 12:17 AM
Workbook_BeforeClose Event Shatin Excel Programming 2 January 24th 04 03:50 AM


All times are GMT +1. The time now is 11:09 AM.

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

About Us

"It's about Microsoft Excel"