jollyroger
Guest
|
I have just started work on my first XLL and have run into an issue with XLL function naming.
I have downloaded the MyXLLAddin1 C# example solution and that builds successfully in VS2012, registers and runs fine in Excel 2010.
I then added my own function called EAN8 (the name of the barcode that the function will encode data for) and this produced an error on loading Excel.
Exception Source: AddinExpress.MSO.2005
Exception Type: System.ApplicationException
Exception Message: 'xlfRegister' failed. Function name: EAN8
Exception Target Site: RegisterXlMethod
I initially thought I had an issue with my code but after various tests it seems to be related to the actual function name. My tests have produced the following results.
RR // WORKS
RRR // WORKS
RRR1 // FAILS
RRRR1 // WORKS
RRR12 // FAILS
The above names are using a simple test function as below.
public static string RRR1(object arg) // FAILS
{
return "test";
}
I can?Â?Ð?ét find a description anywhere specifying what is allowed and what isn?Â?Ð?ét. The problem only seems to happen when a number is at the end of the function name but only when it is in combination with a small number of characters in the function name.
Can you clarify why this is happening and what combination of letters and numbers are allowed. I was hoping to use EAN8 and EAN13 for barcode functions names but these will both fail.
Regards
Roger |
|
Sergey Grischenko
Add-in Express team
Posts: 7233
Joined: 2004-07-05
|
Hi Roger,
If you use digits at the end of function names, the number of characters should be more or equal 4. I didn?Â?Ð?ét find any description of this issue. But I tested the C++ example from the XLL SDK and it produced the same issue. |
|
jollyroger
Guest
|
Hi Sergey
Thank you for the quick response. Now that I know it is an Excel limitation I can come up with suitable function names.
Thanks
Roger |
|
Andrei Smolin
Add-in Express team
Posts: 18823
Joined: 2006-05-11
|
Hello Roger,
Yes, the issue is an Excel restriction: a cell name cannot be used as a function name. That is, you get the problem because "EAN8" is a valid cell name.
Andrei Smolin
Add-in Express Team Leader |
|