Chh Posted June 13, 2020 Share Posted June 13, 2020 Hello All, first of all thanks for providing this great forum, I found so many helpfull things here over the past years. After hours of searching in this forum and on google I still can't find a solution to my problem, so I decided to sign up here and post my question. I've got some issue with calling a method of an COM Object, below there is a code snipped of what I'm trying to do. Dim $Source = 2 #cs I think this is the value of OPC_DS_DEVICE #ce Dim $NumItems = 10 Dim $ServerHandles[10] Dim $Values[10] Dim $Errors[10] Dim $Qualities[10] Dim $TimeStamps[10] $OPCGroup.SyncRead($Source, $NumItems, $ServerHandles, $Values, $Errors, $Qualities, $Timestamps) It seems like I did something wrong by passing these arrays to the method. The error handler throws the following error. err.windescription: Type mismatch. err.number is: 80020005 err.lastdllerror is: 0 err.source is: err.helpfile is: err.helpcontext is: Other methods of $OPCGroup work fine so there must be something wrong with the bottom line. According to the documentation the syntax of the method is: SyncRead(Source As Integer, NumItems As Long, ServerHandles() As Long, ByRef Values() As Variant, ByRef Errors() As Long, Optional ByRef Qualities As Variant, Optional ByRef TimeStamps As Variant) I've got also an VB Code as an example out of the documentation which is supposed to work. Dim Source As Integer Dim NumItems As Long Dim ServerIndex As Long Dim ServerHandles(10) As Long Dim Values() As Variant Dim Errors() As Long Dim Qualities() As Variant Dim TimeStamps() As Variant Source = OPC_DS_DEVICE NumItems = 10 OneGroup.SyncRead Source, NumItems, ServerHandles, Values, Errors, Qualities, TimeStamps Can someone please tell me how to pass the arrays correct? Thanks very much in advance! BR, Chris Link to comment Share on other sites More sharing options...
Chh Posted June 26, 2020 Author Share Posted June 26, 2020 Does really no one have any idea??? I really appreciate even the tiniest hint! 🙂 Regards, Chris Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now