I support and periodically enhance a VBA app within Excel 2007 that uses the PI-SDK extensively. I just released a modification to the app. I am now experiencing some client PC's that throw the error message "Compile Error: Method or data member not found." while other client PC's at the same facility can run the exact same app & code, same PI tags, same PI server just fine. Both those that can and those that cannot are using Excel 2007 (sp?), DataLink v4.2.1, and PI-SDK v18.104.22.1686.
The code appears to stop in one of two places within the IDE, both of which are PI-SDK code modules copied almost verbatim from OSIsoft example code (with the exception of the GetPIServername function:
Sub GetPISnapshot(ByVal Tagname As String, _ ByRef SnapshotValue As Variant, _ ByRef Timestamp As Date, _ ByRef ErrorFlag As Boolean) On Error GoTo Handler1 Dim svr As PISDK.Server Set svr = PISDK.Servers(GetPIServerName) svr.Open Dim point As PIPoint Set point = svr.PIPoints(Tagname) Dim pv As PIValue Set pv = point.Data.Snapshot SnapshotValue = pv.Value Timestamp = pv.Timestamp.LocalDate Exit Sub Handler1: MsgBox Err.Description + " " + CStr(Hex(Err.Number)), _ vbOKOnly, "Error: FAILED TO GET SNAPSHOT VALUE FROM PI" ErrorFlag = True End Sub
Sub GetPIArcValue(ByVal Tagname As String, _ ByVal dTestTime As Date, _ ByVal rtType As RetrievalTypeConstants, _ ByRef vArcValue As Variant, _ ByRef dArcTime As Date, _ ByRef ErrorFlag As Boolean) On Error GoTo Handler1 Dim svr As PISDK.Server Set svr = PISDK.Servers(GetPIServerName) Dim point As PIPoint Dim dT As New PITimeFormat dT.InputString = CStr(dTestTime) Set point = svr.PIPoints(Tagname) Dim pv As PIValue Set pv = point.Data.ArcValue(dT, rtType) dArcTime = pv.Timestamp.LocalDate If IsNull(pv.Value) Then vArcValue = Null Else vArcValue = pv.Value End If Exit Sub Handler1: MsgBox Err.Description + " " + CStr(Hex(Err.Number)) _ , vbOKOnly, "Error: FAILED TO GET VALUE FROM PI ARCHIVE" ErrorFlag = True End Sub
I cannot replicate the error myself, as my development PC runs the code without error. Regarding References, I have confirmed that the PC's that throw the error do not indicate any references as "missing, including PISDK 1.3 TypeLibrary, PISDKCommon 1.0 Type Library, and PITimeServer 1.0 Type Library.
For now, the facility has gone back to the prior version, which uses the exact same code as above without issue.
I'm stumped. Has anyone seen anything like this, or have ideas as to where to investigate?