MATLAB: Am I unable to use MLGetVar in a VBA Function with Excel Link 2.4 (R2006b)

Spreadsheet Link

The Excel Link 2.4 (R2006b) documentation states that MLGetVar can be used in macro subroutines but not in functions. However, the following VBA custom function seems to work:
Function foo()
Dim returnValue As Variant
On Error GoTo Handle
MLEvalString "s = 99;"
MLGetVar "s", returnValue
foo = returnValue
Exit Function
Handle:
StringTest = "Error: " + Err.Description
End Function
When I use the following Excel Link based function:
Function badGetVarFunc(varX As Variant) As Variant
On Error GoTo ErrorHandler
MLShowMatlabErrors "yes"
MLEvalString "clear"
MLPutVar "x0", varX
MLEvalString "y0=-2*x0"
MLGetVar "y0", varY
badGetVarFunc = varY
Exit Function
ErrorHandler:
MsgBox (Err.Description)
End Function
in an Excel cell:
=badGetVarFunc(13)

Best Answer

This bug has been fixed in Release 2007b (R2007b). For previous product releases, read below for any possible workarounds:
This is a documentation error in the function reference page for MLGetVar in Excel Link 2.4 (R2006b). MLGetVar can in fact be used in both macro subroutines and custom functions.