Hey got another idea if any of the above don't work. I am guessing that your OPC control is checking the variant type of the passed variant and if it isn't UI4 then it is ignoring it. So, how about forcing the issue with CopyMemory API...
If it works, UI2 is &H2000 Or 18Code:Dim vData As Variant, vType As Integer vType = &H2000 Or 19 ' array of UI4 vData = CVar(Vals()) ' write to the variant structure what type of data it contains CopyMemory ByVal VarPtr(vData), vType, 2& ' now the variant thinks it is UI4; how now? ASyncItemValues(1) = vData
Listing of Variant Type codes
Edited: I see I pretty much repeated what Merri posted. Even though VB can't use the vData variant while it thinks it is UI4, your OPC should be able to. If the vData variant needs to be read by your VB app, then you'd have to change the UI4 to simply I4 which is &H2000 Or 3 for a an array of longs; then you'd be able to read the data back using VB.




Reply With Quote