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 WorkbookBeforeClose 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
"this operation has been canceled due to restrictions in effect on stumped-in-excel[_2_] Excel Discussion (Misc queries) 2 March 14th 09 02:32 PM
question about Auto_Close and WorkbookBeforeClose Brian Murphy Excel Programming 8 October 9th 04 08:08 PM
Run Macro If Save Is Canceled On SaveAs Window In VBA Celtic_Avenger[_42_] Excel Programming 0 September 19th 04 09:30 AM
Run Macro If Save Is Canceled On SaveAs Window In VBA Celtic_Avenger[_41_] Excel Programming 2 September 19th 04 02:34 AM
Handling WorkbookBeforeClose and WorkbookBeforeSave Tom Ogilvy Excel Programming 0 September 19th 03 06:27 PM


All times are GMT +1. The time now is 10:06 PM.

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"