I believe that wrapping a parameter in parentheses forces it to be passed ByVal - even if you've coded ByRef.
And, in VBScript, everything is a Variant (not quite the same thing as an Object) - so you may have to use CVar occasionally. On Mon, Nov 29, 2010 at 8:32 PM, Mark Hurd <markeh...@gmail.com> wrote: > I've replicated your problem with a simple VB6 class. > > I'm not sure of the actual cause but your fix is: > > id = client.SendRequest((request)) > > because the working client.SendRequest(request) > > is really > > client.SendRequest (request) > > or > > Call client.SendRequest((request)). > > The call corresponding to the original id = line Call > client.SendRequest(request) > > or > > client.SendRequest request > > fails with TypeMismatch for me. > > I assume the problem is VBScript only deals with Objects most of the > time, and so doesn't like the original accurate type being passed to > the (correct) accurate type, but the () returns the object to Object, > which it doesn't mind passing anywhere. > > -- > Regards, > Mark Hurd, B.Sc.(Ma.)(Hons.) > > On 28 November 2010 18:09, Greg Keogh <g...@mira.net> wrote: >> I’ve been running experiments for almost two hours solid now, making mock >> functions and passing different arguments and return types in all >> combinations I can think of. I’ve cleaned my environment, registered, >> unregistered, etc. Everything works perfectly in unit tests, only in the VBS >> file I find this specific failure rule: >> >> >> >> I cannot get a return value from a method call that has a COM object as an >> argument. >> >> >> >> Sadly, I can’t just pass primitive types as the arguments to the function, >> as it takes far too many and some are collections. >> >> >> >> I think I’ll give up and have a glass of wine. >> >> >> >> Greg >