AnsweredAssumed Answered

Change Dataset Expression via VBA code

Question asked by drausim127@spiratec on Jul 14, 2015
Latest reply on Jul 14, 2015 by dng

Hi,

 

a few month ago I have written a short vba programm to rename/change the PI Tags of a dataset expression in a processbook file. Two month ago we have upgraded our PI environment and now the progamm doesn't works and I don't know why. In the line "Set piMyDSProperties = piMyDS...." I always receive the exception "Type mismatch".

 

Sub TestDrm()
    Dim piDSExpression As String
    Dim piMyDS As Datasets
    Dim piMyDSProperties As PIExpressionDataset
    Dim piPB As PBObjLib.ProcBook
    
    Set piPB = Application.ProcBooks.Open("U:\temp\KNA\Test.piw")
    Set piMyDS = piPB.Datasets
    Set piMyDSProperties = piMyDS.GetDataset("TEST1")
    piDSExpression = piMyDSProperties.Expression
    // Do some Expression changes
End Sub

 

So can somebody give me short information how I can change dataset expression via VBA code?

 

best regards

Markus

Outcomes