AnsweredAssumed Answered

Hello everyone, I need your help to add a trend in a VBA6 form

Question asked by Castillo1979 on Apr 27, 2017
Latest reply on May 1, 2017 by dhollebeek

The code in processbook would be this:

 

Sub CreateTrend()

 

'PB Symbol object

Dim oTrend As Trend

Dim sServer As String

Dim sTagName, sTagName1 As String

 

'Server_name_here

sServer = ""

 

'tag_name_here

sTagName = "10GHF56CF001.ZQ01"

sTagName1 = "10LBA20CP901.XQ01"

 

'add a trend object to the Symbols collection

'the Add function will return a reference to the trend object

'if successful

  Set oTrend = ThisDisplay.Symbols.Add(pbSymbolTrend)

             

       With oTrend

            .Name = "TestTrend1"

            .Top = 14950

            .Left = -14700

            .Width = 1000

            .Height = 750

           

            'call the AddTrace function for every tag to be trended

            .AddTrace sServer & sTagName

            .AddTrace sServer & sTagName1

           

            'this trend will display the previous 12 hours

            .SetStartAndEndTime Format(DateAdd("h", -24, Now), _

             "dd-mmm-yy hh:nn:ss"), Format(Now, "dd-mmm-yy hh:nn:ss")

            

             'set the title text

              .TrendTitle = "Trend Example"

     End With

 

End Sub

 

But this code does not work in VBA6, someone could help me?

Outcomes