1 Reply Latest reply on Aug 28, 2013 11:57 AM by Marcos Vainer Loeff

    Changing Tag and Pi Server name automatically in a Excel datalink report


      Hi, is there a macro to change the tag names and new PI server name in an excel datalink report automatically?


      The macro should be able to look through a list of old tagname and new tagname list then should


      be able to change accordingly. We will be migrating all the reports to a new PI server.







        • Re: Changing Tag and Pi Server name automatically in a Excel datalink report
          Marcos Vainer Loeff

          Hello Roland, 


          Just to confirm if I understood correctly. You want to change the content of the cells of your Excel spreadsheet and not the names of the tags in your PI Server, is this correct?


          If this is true, you can create a button on your spreadsheet which will execute a subroutine. If you are using Excel 2010, it is interesting to add the Developer Tab so you can add the button. Then, below you can find a code snippet that will update the value of each cell from A3 to A6:



          Sub Button1_Click()
          Dim cell As Range
          For Each cell In Range("A3:A6")
              cell.Value = GetNewTagName(cell.Value)
          End Sub



          The only thing missing is that you need to create function that will receive the content of the cell which is an old name and it should return the new tag name after searching this information in a table or spreadsheet.

          Function GetNewTagName(Value As String) As String
          End Function

           You can do the same with the PI Server name.


          I hope this will help you!!