Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #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



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 225
Default 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.

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
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 01:46 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"