Why the file crash in excel 2013

zhouyi

New Member
Joined
Feb 25, 2013
Messages
1
I had run the following simple code in excel 2003 well, but when I open the file in excel2013, excel may crash. please give me ideas

Private Sub WorkSheet_BeforeDoubleClick(ByVal target As Range, CANCEL As Boolean)
ActiveWorkbook.Close
End Sub

the following rus well both in excel2003 and 2013
sub test()
ActiveWorkbook.Close
End Sub

with my regards.
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Welcome to MrExcel.

I confirm that your code causes a crash in Excel 2007, 2010 and 2013, but not in 2003. Sorry, I don't know why.
 
Upvote 0
Welcome to the MrExcel board!

I believe that it is a known bug (but nothing has been done about it).

A workaround is to put your working "test" sub in a standard module an then use this in your double-click event code
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
  Cancel = True
  Application.OnTime Now, "test"
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,343
Messages
6,124,404
Members
449,156
Latest member
LSchleppi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top