So I have a custom function I developed in ExcelDNA and have it loaded up in Excel. It works fine when I type in parameters as strings and call the function, however, when I put those strings into cells and then pass them in by referencing the cell, it fails. Does anyone know what the problem could be?
Example:
If I type this into a cell: =GetDiscountFactor("USD", "EUR", "11/01/2011", "11/01/2011 16:00", "Bid")
It works - but this: =GetDiscountFactor(A2,B2,C2,D2,E2)
fails, even though those cells are pointing to values that are identical to the ones I can type in.
Thanks.
It's probably referencing the date/times as double or date. Change the parameters in your function to objects instead. E.g.,
Public Function GetDiscountFactor(byval sUSD As String, ByVal sEUR As String _
, ByVal oDate1 As Object, ByVal oDate2 As Object, ByVal sBid As String)
You can check to see what type of variable it is later in your code.