![]() |
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 |
Workbook_BeforeClose event is not canceled
Hi
This is an known issue, and it has been fixed in office 2003, I have verified it on my side. Here is a link for your reference. BUG: Cancel parameter for Office events is ignored in Visual Studio .NET 2003 (830519) http://support.microsoft.com/default...B;EN-US;830519 Best regards, Peter Huang Microsoft Online Partner Support Get Secure! - www.microsoft.com/security This posting is provided "AS IS" with no warranties, and confers no rights. |
All times are GMT +1. The time now is 11:03 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com