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
Bookmarks