Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Cancelling the BeforeClose Event


I am using .NET Tools for Office with Excel 2003 Beta.

There is a 'Cancel' flag in the BeforeClose event and if
it is assigned the value of 'True' it is supposed to stop
Excel for closing, but this does not seem to work for me.

Is there any other work arounds?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 120
Default Cancelling the BeforeClose Event

Hi Troy,

Thank you for posting in MSDN managed newsgroup!

Based on my experience, if there is no any client codes intervening in the BeforeClose event, the true value of Cancel will stop the closing of Excel in
released version.

I'd suggest you can check whether some client codes control the closing procedure which disables the Cancel. Furthermore, you will need to install
the released version of Visual Studio Tools for Office System 2003. The beta version may contain some bugs which cause this issue.

Please feel free to let me know if you have any further questions.

Does this answer your question? Thank you for using Microsoft NewsGroup!

Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default Cancelling the BeforeClose Event

Hi Troy,

I am using .NET Tools for Office with Excel 2003 Beta.

There is a 'Cancel' flag in the BeforeClose event and if
it is assigned the value of 'True' it is supposed to stop
Excel for closing, but this does not seem to work for me.

Is there any other work arounds?


This was a known issue in the betas of VSTO, but has been fixed (I
believe) in the release version.

Regards

Stephen Bullen
Microsoft MVP - Excel
www.BMSLtd.co.uk

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 459
Default Cancelling the BeforeClose Event

I tested this on VSTO 2003 and conclude it has not been fixed.

--

Stephen Bullen wrote in message ...
Hi Troy,

I am using .NET Tools for Office with Excel 2003 Beta.

There is a 'Cancel' flag in the BeforeClose event and if
it is assigned the value of 'True' it is supposed to stop
Excel for closing, but this does not seem to work for me.

Is there any other work arounds?


This was a known issue in the betas of VSTO, but has been fixed (I
believe) in the release version.

Regards

Stephen Bullen
Microsoft MVP - Excel
www.BMSLtd.co.uk

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default Cancelling the BeforeClose Event

Hi Onedaywhen,

I tested this on VSTO 2003 and conclude it has not been fixed.


I just downloaded the released version from MSDN and installed it. I
used the following code to test it:

Private Sub ThisWorkbook_BeforeClose(ByRef Cancel As Boolean) _
Handles ThisWorkbook.BeforeClose

MsgBox(ThisWorkbook.Name)
Cancel = (UCase(ThisWorkbook.Name) = "BOOK1.XLS")
End Sub

I found that when I saved the workbook as book1.xls and tried to close
it, it didn't close. When I saved it as book2.xls and tried to close
it, it closed fine. So I conclude that the Cancel property is working
fine in the released code.

Regards

Stephen Bullen
Microsoft MVP - Excel
www.BMSLtd.co.uk



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 459
Default Cancelling the BeforeClose Event

Stepen,
I agree your results.

I was using C# when I tested this last week so I did a re-test using:

protected void ThisWorkbook_BeforeClose(ref bool Cancel)
{
if (ThisWorkbook.Name=="Book1.xls")
Cancel = true;
}

I don't know what went wrong last week but today I got the same
results as you. I too now conclude that the Cancel property is working
fine in the released code.

Apologies for any confusion caused.

--

Stephen Bullen wrote in message ...
Hi Onedaywhen,

I tested this on VSTO 2003 and conclude it has not been fixed.


I just downloaded the released version from MSDN and installed it. I
used the following code to test it:

Private Sub ThisWorkbook_BeforeClose(ByRef Cancel As Boolean) _
Handles ThisWorkbook.BeforeClose

MsgBox(ThisWorkbook.Name)
Cancel = (UCase(ThisWorkbook.Name) = "BOOK1.XLS")
End Sub

I found that when I saved the workbook as book1.xls and tried to close
it, it didn't close. When I saved it as book2.xls and tried to close
it, it closed fine. So I conclude that the Cancel property is working
fine in the released code.

Regards

Stephen Bullen
Microsoft MVP - Excel
www.BMSLtd.co.uk

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 120
Default Cancelling the BeforeClose Event

Hi,

Thank you for replying!

You are all welcome!

Thank you once more for using Microsoft NewsGroup!

Wei-Dong Xu
Microsoft Product Support Services
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
beforeclose placement Curt Excel Discussion (Misc queries) 9 August 27th 07 08:00 PM
PASSWORD PROTECT BEFORECLOSE KandK Excel Discussion (Misc queries) 4 June 8th 06 09:34 AM
BeforeClose, Auto_Close, and ActiveX Server Don Wiss Excel Programming 0 November 21st 03 12:21 AM
BeforeClose event - Savings Mike[_40_] Excel Programming 3 September 24th 03 11:33 AM
Excel - BeforeClose Problem... Al Mackay Excel Programming 0 September 22nd 03 12:26 PM


All times are GMT +1. The time now is 10:21 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"