PC Review


Reply
Thread Tools Rate Thread

[C#][COM] Excel crashs when a cell name is a function name

 
 
=?Utf-8?B?TmllbHMgVmFuIFZsaWV0?=
Guest
Posts: n/a
 
      19th Mar 2007
Here is how to reproduce the problem:
1. Create a C# COM server
- Create a new DLL, with register for COM interlop
- Add the code (available below).
2. Test
- In Excel->Tools->AddIn->Automation, choose TestServerCom.TestServerCom
- In cell B1, type =Hello("niels").
- the value of B1 will be: "Hello niels!";
3. Test the crash
- Select A1
- Define the name of the cell A1 this way: on the left of the formula
bar, there is a white box where A1 is written. Change it to Hello.
- Excel crashs.

Notes:
Different behaviours:
- If the user changes the name the following way, it does not crash:
Insert->Name->Define-> Hello
- With C++ XLL, it productes #ref, but do not crash
- With 'standard' functions (SIN, MAX, ...), it works. If you define A1 to
SIN as stated in point 3, then =SIN(3) refers to the formula, =SIN*3 refers
to the cell.

Config:
- C#2, Visual 2005 patched with 908002
- Excel 2002 English SP3, under Windows XP

I would like you to confirm that it is a bug, and to know if a patch exists.

I google, but could not find anything (too many results with "excel",
"name", "COM", ...).

Here is the code to build a simple COM server:

using System;
using System.Runtime.InteropServices;
namespace TestServerCom{
[ClassInterface(ClassInterfaceType.AutoDual)]
[ComVisible(true)]
public partial class TestServerCom {
public string Hello(string your_name)
{ return "Hello, " + your_name + "!";}

[ComRegisterFunctionAttribute]
public static void RegisterFunction(Type t)
{
Microsoft.Win32.Registry.ClassesRoot.CreateSubKey(
"CLSID\\{" + t.GUID.ToString().ToUpper() +
"}\\Programmable");
}
[ComUnregisterFunctionAttribute]
public static void UnregisterFunction(Type t)
{
Microsoft.Win32.Registry.ClassesRoot.DeleteSubKey(
"CLSID\\{" + t.GUID.ToString().ToUpper() +
"}\\Programmable");
}}}

Thanks
PS: By mistake I posted it in office.Addins also.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Crashs When Trying To Save File, Help. =?Utf-8?B?QmlsbCBOZWVkcyBIZWxw?= Microsoft Excel Crashes 7 12th Nov 2007 09:11 PM
[C#][COM] Excel crashs when a cell name is a function name =?Utf-8?B?TmllbHMgVmFuIFZsaWV0?= Microsoft Excel Programming 3 16th Mar 2007 05:40 AM
IBM thinkpad with projector, Excel crashs =?Utf-8?B?ZW1iZWRkZWQgRXhjZWwgQ2hhcnQgd2l0aCBwcm9q Microsoft Excel Programming 3 15th Dec 2005 04:28 PM
new install of XP . Computer crashs starts up runs crashs. AL Windows XP Hardware 3 30th Apr 2004 10:01 PM
Re: When I Import an Access Table With an Excel Function in a Cell it Displays as Text not as a Function in Excel Niek Otten Microsoft Excel Programming 2 18th Sep 2003 03:55 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:27 AM.