3 Replies Latest reply on Apr 20, 2017 12:33 PM by gregor

    PIPutVal returning error

    dmandado

      Hi all,

       

      I have several excel sheets with the PIPutVal macro up and running. In one of them, the macro started to fail without any change.

      MacroResult provide the following message: "Cannot connect to server 'a'". I use the same syntaxis than in the rest (which works perfectly).

       

      Any experience with this issue?

       

      This is the code:

       

      Sub Grabardatos()

      '

      ' Grabardatos Macro

          Dim strTagName As String    'Tagname

          Dim ValueCell As Range   'Cell reference containing value to be written

          Dim strTime As String       'Timestamp

          Dim ResultCell As Range  'Cell reference to hold result

         

             

          Dim macroResult As Variant  'PIPutVal() result

        

          'AUXILIARY VARIABLES

          Dim strServerName As String 'PI server name

       

              strTime = Now

             

              strServerName = "MSESBAPL004"     'Grabar datos en variables

             

              Set ValueCell = Worksheets("Corte_Trituradores").Cells(9, 7)

              Set ResultCell = Worksheets("Corte_Trituradores").Cells(44, 7)

              macroResult = Application.Run("PIPutVal", "PI_PLANTA_125A_GRUESOS_MONTAÑA", ValueCell, strTime, strServerName, ResultCell)

        • Re: PIPutVal returning error
          gregor

          Hello Daniel,

           

          Can you please verify using PISDKUtility.exe if the connection shows in the Known Servers Table (KST) under PI SDK -> Connections?

           

          If it shows in there, please try to connect. Does that work?

           

          Please also check the local PI Message Log for more detailed information using pigetmsg.exe. Please let us know if you need more guidance with this step.

           

          What version of PI DataLink is installed. Please check with Programs and Features dialog from Control Panel.

          Looking at the documentation for PIPutVal and the snippet you posted, I get the impression that the amount of parameters is wrong. Can you please verify?

            • Re: PIPutVal returning error
              dmandado

              Hi Gregor,

               

              Thanks for your fast reply.

               

              1. Yes, the server shows as connected.

              2. In Pi Message Log, there is no connection line regarding PIPutVal

              3. I have the PI Datalink 2015 version

              4. Have the 5 arguments that are needed.

               

              What it´s surprising is that the same macro is working correctly in a different excel or tag...