thanks Govert, this worked fine, you're too kind.
However, it still doesnt work properly - sorry if I am asking stupid questions...
I have seen that the UDF only works if i declare the return function as an object. If I try to declare the return array as a boolean, the UDF doesnt even show up in my functions list in Excel.
This does not work :
<ExcelDna.Integration.ExcelFunction(Category:="GuidoTools", Description:="Set/reset function", IsMacroType:=True)> _
Public Function GuidoTools_SetResetWitboolean( _
<ExcelDna.Integration.ExcelArgument(AllowReference:=True)> ByVal setcondition As Boolean, _
<ExcelDna.Integration.ExcelArgument(AllowReference:=True)> ByVal resetcondition As Boolean) _
As Boolean(,)
Dim x(0, 2) As Boolean
Dim caller As ExcelReference = XlCall.Excel(XlCall.xlfCaller)
Dim a As Boolean = CBool(caller.GetValue(0, 0))
If setcondition Then
x(0, 0) = setcondition
Else
x(0, 0) = a
End If
x(0, 1) = setcondition
x(0, 2) = resetcondition
Return x
End Function
This works...
<ExcelDna.Integration.ExcelFunction(Category:="GuidoTools", Description:="Set/reset function", IsMacroType:=True)> _
Public Function GuidoTools_SetResetWitboolean( _
<ExcelDna.Integration.ExcelArgument(AllowReference:=True)> ByVal setcondition As Boolean, _
<ExcelDna.Integration.ExcelArgument(AllowReference:=True)> ByVal resetcondition As Boolean) _
As object(,)
However, when using the second approach, I have problems to cast a boolean into an object.
So question :
How can I declare the return array to be of a particular type, and not only object ??? Any attempt to return a boolean array seem to fail on my end.
thnaks for your much appreicated help, and congrats for this wonderfull piece of software.
guido