Bryan Rasmussen - 2013-10-30

This is similar to other questions on the topic, but with a twist.

I am trying to callan ActiveX control method that requires you to pass in an error Variant by reference. I can figure out how to do it if the Variant is an integer or string reference, but not if it is an error.

What I have so far.

ActiveXComponent comp = new ActiveXComponent("FOO.BAR");
Variant errcode = new Variant(0,true);
Dispatch.call(comp, "SomeMethod", errcode);

This will not work of course because errcode is a type VT_I4 (0x4003). I tried to use

errcode = errcode.changeType(Variant.VariantError);

but it doesn't seem to do anything. (In fact, I'm not sure what changeType is for---it seems to have no effect.)

Is there some other way to convert errcode into a type (0x400A)?