Add-in Express 8 Excel XLL Addin

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

Add-in Express 8 Excel XLL Addin
 
Michael Mandler




Posts: 34
Joined: 2014-03-26
Hello,

I'm having an issue with Add-in Express 8 and and XLL function's. I'm not sure if this change is by design or an issue with the current version.

Let's say I have a function defined like this


public static object GetTotalFundAssets(object[] funds, DateTime periodenddate, bool includeencumbrance = false,
                        bool includereportonly = false, int throughperiodno = 0)
{


}


If I provide a cell reference to the second parameter periodenddate, everything works properly. If I provide a date in the format of "3/31/14" (in quotes), the value will come into the function as 01/01/0001. In previous versions of add-in express this would come in as 3/31/14.

Is this a known change in the new version or a bug?

Thanks!
Posted 16 Nov, 2015 15:38:43 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Hello Michael,

I suppose this is cased by some difference in the Regional Settings, see Control Panel | Region and Language | Formats | Additional settings | Date.


Andrei Smolin
Add-in Express Team Leader
Posted 17 Nov, 2015 01:56:23 Top
Michael Mandler




Posts: 34
Joined: 2014-03-26
Hi Andrei,

The date settings are correct and haven't changed. This is happening on all computers that have the version built with Add-in express 8. If I build the same Add-in with version 7 the date problem disappears. It's not an option for us to go back to version 7 though, as we need to support Office 2016.
Posted 17 Nov, 2015 08:32:55 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Hello Michael,

I see. In Add-in Express 7, dates were handled by the standard marshaler provided by the .NET Framework. In case you enter a date incorrectly, e.g. when handling "3/31/14" on a non-English localization, this causes an exception which crashes Excel. In Add-in Express 8, we introduced a custom marshaler; when an exception occurs, the marshaler returns the minimal date. We will consider handling such strings in the next Add-in Express build but again, handling "3/31/14" on a non-English localization would return a localized equivalent of 01/01/0001. A correct workaround for you would be changing the parameter type from System.DateTime to System.Object and handling it depending on the actual data type passed to your function.


Andrei Smolin
Add-in Express Team Leader
Posted 17 Nov, 2015 10:06:42 Top
Michael Mandler




Posts: 34
Joined: 2014-03-26
Thanks for the information Andrei and considering making it work similar to how it did previously.
Posted 18 Nov, 2015 11:09:13 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
You are welcome.


Andrei Smolin
Add-in Express Team Leader
Posted 19 Nov, 2015 02:47:48 Top