Many long parameter names

Dec 4, 2011 at 3:23 AM

Hi,

I have some UDF functions with many parameters each with long names, and total length exceeding 255.

The registration of the functions failed in Excel2010.

I read: http://msdn.microsoft.com/en-us/library/aa730920(v=office.12).aspx

could it be related?

Any solution/workaround?

Thanks,

CoolestUgly

 

Dec 4, 2011 at 3:35 AM

Seems that http://blogs.msdn.com/b/vsofficedeveloper/archive/2008/09/10/xl12-xll-unicode-update.aspx also related.

Coordinator
Dec 4, 2011 at 7:49 PM

This is an Excel limitation, but I'm not sure whether I've checked the status in Excel 2010.

I'll have a look and post back.

Dec 17, 2011 at 1:56 AM

Hi Govert,

I just used the xlw and confirmed that xlw can have argument with length > 300 in Excel 2010 (32bit).

Seems it is not Excel limit. Any idea how to fix it in ExcelDNA?

Thanks,

CoolestUgly

Dec 18, 2011 at 2:54 AM

Hi Govert,

I mean that the total length of all parameter names can be more than 300 in xlw (32 bit 2010 Excel).

In ExcelDNA, I have tried to comment out the following in xlladdin.cs:

if (argumentNames.Length > 255)            

       argumentNames = argumentNames.Substring(0, 255);

But it still not work.

Then I looked at the defintion of XlString12:

{

public unshort Length;

public fixed char Data[1];

}

 

Should it be just:

{ public fixed char Data[1]}, and put the length in the first element of allocated Data array.

 

Thank you for the wonderful software!

Best Regards,

CoolestUgly

 

Coordinator
Dec 18, 2011 at 4:14 PM
Edited Dec 23, 2011 at 9:10 PM
I can have a look on Wednesday or Thursday.

 

Dec 19, 2011 at 10:39 PM

Hi Govert,

Do not worry. 

Currently I just wrap the third party function into my UDF which gives simple parameter names.

It works perfect using the workaround.

So you really do not have to spend time during Christmas season on the issue.

Thanks again for your great work,

and Merry Christmas and Happy New Year.

CoolestUgly

Coordinator
Dec 23, 2011 at 9:33 PM

I had a quick look and it seems the registration still fails for argument strings longer than 255 chars (Excel Version: 14.0.6112.5000 (32-bit).

(Which is what you also checked by commenting out the truncation.)

Could you perhaps send me the xlw-based .xll which has a function with long argument name string?

(The XlString12 definition is correct.)

Thanks,

Govert 

Dec 25, 2011 at 8:36 PM

Hi Govert,

I tried in xlw the following UDF.

In Excel, I put formula: =Multiply(1,2,3,4,5,6), and then click function winzard, it works and show all six long parameters.

(Note: if clicking function wizard without typing the "=Multiply(1,2,3,4,5,6)", then the function wizard will give you only first parameter.)

How can I send the xll file to you?

Thanks,

CoolestUgly

         [ExcelExport("Multiply ")]        public static double Multiply(                [Parameter("a123456789012345678901234567890123456789012345678901234567890")]

double a123456789012345678901234567890123456789012345678901234567890,               

[Parameter("b123456789012345678901234567890123456789012345678901234567890")]

double b123456789012345678901234567890123456789012345678901234567890,               

[Parameter("c123456789012345678901234567890123456789012345678901234567890")]

double c123456789012345678901234567890123456789012345678901234567890,               

[Parameter("d123456789012345678901234567890123456789012345678901234567890")]

double d123456789012345678901234567890123456789012345678901234567890,               

[Parameter("e123456789012345678901234567890123456789012345678901234567890")]

double e123456789012345678901234567890123456789012345678901234567890,               

[Parameter("f123456789012345678901234567890123456789012345678901234567890")]

double f123456789012345678901234567890123456789012345678901234567890                             )     

 

  {           

return

a123456789012345678901234567890123456789012345678901234567890                * b123456789012345678901234567890123456789012345678901234567890                * c123456789012345678901234567890123456789012345678901234567890                * d123456789012345678901234567890123456789012345678901234567890                * e123456789012345678901234567890123456789012345678901234567890                * f123456789012345678901234567890123456789012345678901234567890;       

}

Coordinator
Jan 1, 2012 at 7:35 PM

This issue was resolved as an Excel limitation that is still present in Excel 2010 - XLW also does not support a total argument name string longer than 255 characters.