AnsweredAssumed Answered

PIPutVal Macro Issues

Question asked by jarosk on Jul 15, 2020

I'm having issues entering data into the PI system using VBA code. I've tried using the timestamp as a range and string. After I run the macro, I don't see anything in the Transfer Result cells. When I added a breakpoint/watch to the macroResults line, it just says "Either the target name is incorrect or the server has rejected the client credentials." These are the correct PI tags. Thank you for your help!


Dim tag as string, vc as range, ts as string, rc as range

' ******************** ENTER DATA TO PI ******************** '

For i = 2 To 115

   tag = Sheet2.Cells(i, 23).Value 'PI tag

   Set vc = Sheet2.Cells(i, 25) 'value cell

   ts = Sheet2.Cells(i, 22).Value 'time stamp

   Set rc = Sheet2.Cells(i, 26) 'results cell

   macroResult = Application.Run("PIPutVal", tag, vc, ts, "IAAFIPI01", rc) 'place data point in PI

Next i