複数のパラメータを出力するには、Excel Builder で自動的に生成される VBA コードを修正する必要があります。
例えば、Excel アドインで関数 FOO をコンパイルする場合、生成された VBA コードを以下のように修正します。
Function foo(x1 As Variant, x2 As Variant) As Variant
Dim aClass As Object
Dim y1, y2 As Variant
On Error Goto Handle_Error
aClass = CreateObject("foocomponent.fooclass.1_0")
'Specify the number of outputs as 2, and specify the two output variables
Call aClass.foo(2,y1,y2,x1,x2)
'Create an array from the outputs using the Array function
allouts = Array(y1,y2)
'Return the array
foo = allouts
Exit Function
Handle_Error:
foo = Err.Description
End Function
Excel ワークシートでこの関数を実行するときには、配列関数 (配列形式/CSE式) として関数を実行します。
つまり、関数の出力引数の数に対応したセルの範囲(水平、垂直、またはエリア)選択を行うことが必要です。その後、F2 キーを押し、通常の式を入力する必要があります。式を入力したら、内容を確定するために Ctrl+Shift+Enter を押します。
結果として、この式は Excel 内で中括弧で表示されます。