Excel crash when going to infinite loop (only with an add-in installed

Add-in Express™ Support Service
That's what is more important than anything else

Excel crash when going to infinite loop (only with an add-in installed
 
nir zamir


Guest


Hi,

The following VB code makes Excel crash:


Sub Worksheet_Change(ByVal Target As Excel.Range)
    Dim arrTargetAdress
    arrTargetAdress = Split(Target.Address, "$")
    Cells(arrTargetAdress(2), arrTargetAdress(1)) = Format(Cells(arrTargetAdress(2), arrTargetAdress(1)), "dd/mm/yyyy")
End Sub


the steps to reproduce:
1. Open Excel 2003/2007
2. Paste this code in the sheet VB code.
3. Write something like 1/1/2007 in any cell.
4. Excel will go to an infinite loop (as this code triggers the Worksheet_Change event over and over again) and then CRASH.

Note: It happens ONLY when an add-in is installed (reproduced it also with an empty add-in).

Thanks,
Nir.
Posted 16 May, 2007 10:52:42 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Nir.

Please changed the code as shown below:

Dim changed As Boolean

Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim arrTargetAdress

arrTargetAdress = Split(Target.Address, "$")

If changed = False Then
changed = True
Cells(arrTargetAdress(2), arrTargetAdress(1)) = Format(Cells(arrTargetAdress(2), arrTargetAdress(1)), "dd/mm/yyyy")
changed = False
End If
End Sub
Posted 17 May, 2007 07:33:37 Top
nir zamir


Guest


Hi Sergey,

We've already fixed this issue in the VB code.

The reason I posted this is to pay your attention to the fact that Excel will crash when going to an infinite loop, only when an Add-in Express COM add-in is present!

Do you know the reason or how to prevent it?

Thanks,
Nir.
Posted 20 May, 2007 08:21:14 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Nir, I am sure this issue will happen with a general shared add-in too.
I think the cause of the issue is in the fact that the Add-in Express add-in connects to Excel events and as a result Excel can't suppress the infinite loop.
Posted 21 May, 2007 04:40:33 Top
nir zamir


Guest


OK...

And I suppose there's nothing we can do about it, correct?
Posted 21 May, 2007 08:48:24 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Yes, I think so.
Posted 21 May, 2007 09:00:52 Top