AnsweredAssumed Answered

PIPutVal returning error

Question asked by dmandado on Apr 20, 2017
Latest reply on Apr 20, 2017 by gregor

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



    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)