Quantcast
Channel: OSIsoft Users Community
Viewing all articles
Browse latest Browse all 1120

Copying a TimeRange from a Trend to an other Trend using VBA in Processbook.

$
0
0

Hi,

 

I'm trying to copy a timerange from  a trend to all the other trends on the same display. The reason i want to do this is, i have a piece of code that puts the cursor on the same timestamp on each trend. This works great, but when i go out of a range on a other trend i get an error. The code i use is as follows.

 

 

Option Explicit
 
Dim WithEvents tndX As PBSymLib.Trend

 

Private Sub Display_SelectionChange()
Dim smbX As PBObjLib.Symbol
 For Each smbX In ThisDisplay.SelectedSymbols
 
    If smbX.Type = pbSymbolTrend Then
 
        Set tndX = smbX
 
    End If
 
Next smbX
 
End Sub

 

Private Sub tndX_DropCursor(bCancel As Boolean, ByVal nCursor As Integer, ByVal NewTime As String)

Dim smbY As PBObjLib.Symbol
 
For Each smbY In ThisDisplay.Symbols
 
    If smbY.Type = pbSYMBOLTYPE.pbSymbolTrend Then
 
        If smbY.CursorCount < 1 Then
            smbY.AddCursor
        End If
 
        smbY.CurrentCursor = 1
        smbY.CursorTime = NewTime
        smbY.SetTimeRange tndX.StartTime, tndX.EndTime
           
    End If
 
   Next smbY
 
End Sub


Viewing all articles
Browse latest Browse all 1120

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>