Hello.
After the issue to read a value in the PI Tag, now I'm experiencing troubles to write the vlaues there. As I do not know the structure of SDK whe I put the code to run it gives back a message "Obrigatory Object" "Incompatible Types".
The main problem is set the variables and objects acordingly with SDK language, once I do not know how to declare the variables to make PI understand what I want. Debugging the code it seems to be able to access the server.
Here is a code's fragment:
Code:...
Dim HoraPI As Date
Dim Horapis As String
Dim Horapis2 As String
Dim ValorTAGPI As Double
Dim PIServer As PISDK.Server
Dim DataHoraPI As New PITimeFormat
Dim et As New PITimeFormat
Dim PIArray As PIValues
Dim PIvalue As PIvalue
'Acess the server
Set PIServer = Servers("SA-POPE-PISERV1")
Call PIServer.Open("UID=***;PWD=****")
TagName = ("CHECKLIST PROG")
Excel.Application.DisplayAlerts = False
Calculate
ActiveWorkbook.Save
Sheets("GERAÇÃO").Select
diadoug = Range("AA3")
'Create a timestap
HoraPI = Range("AH1")
Horapis = Left(HoraPI, 14)
diatag = CDbl(DateValue(HoraPI))
Range("AA3").Select
Valor$ = ActiveCell.Value
'Save a value in TAG
'Set PITag = "checklist prog"
Horapis2 = Horapis & "0:11"
'DataHoraPI = Horapis & "0:11"
ValorTAGPI = diatag & "101"
Call PITag.Data.UpdateValue(Horapis2, ValorTAGPI)
...
Another thing is I guess I will need to set the references with the VBA too. How to do that?
Thanks for any help.