Hi
Based on my research, there seems to be infinite recursion - if in the
change event you modify the sheet, which fires another change event, and so
on and so forth.
So we need to prevent reentrancy in your event handler with a bool flag.
bool bChanged = false;
void exApp_SheetChange(object Sh,
Microsoft.Office.Interop.Excel.Range Target)
{
if( bChanged )
return;
try
{
bChanged = true;
Target.Value2 = "Test2";
Target.set_Value(Excel.XlRangeValueDataType.xlRang eValueDefault, "Test");
Target.Font.Italic = true;
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
finally
{
bChanged = false;
}
}
You may have a try.
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.