Is it possible to read the time interval of a trend using VBA on ProcessBook?
I need this data for a calcaulation.
Currently I'm trying to calculate this value using the TimeRangeChange Event. And It works fine when I zoom in in a trend, but when I click on the refresh button to change again the time range of the trend I get an Run-Time error message the type mismatch.
I can keep zooming in as many times as I want without a problem but when I zoom out th etrend I get the error.
It seems that for some reason the StartTime and EndTime values changes from String variable type to something else and causes the error.
I already declared my variable TimeRNG as variable, double, etc etc and didn't work.
I try to reset the values of StartTime and EndTime to a string value, but they are read only.
Any hel will be fully appreciated.
Attached my VBA code.
Private Sub Trend1_TimeRangeChange(ByVal StartTime As String, ByVal EndTime As String)
Dim TimeRNG As Variant
'Changes The Time Range of the second Trend
Trend2.SetTimeRange StartTime, EndTime
' Asign TimeStamps StartTime and EndTime to "value(3) and (4)"
ThisDisplay.Symbols.Item(2).SetTimeRange "", StartTime
STTIME_TXT.Text = StartTime
ThisDisplay.Symbols.Item(3).SetTimeRange "", EndTime
ENTIME_TXT.Text = EndTime
'Trying to calculate the Time Range between EndTime and StartTime
'This valuecan be found at the bottom of the trend
'Or can be found also on the Statistics seccion of the details and annotations window
TimeRNG = (DateValue(EndTime) + TimeValue(EndTime))
TimeRNG = (TimeRNG - (DateValue(StartTime) + TimeValue(StartTime))) * 24
TIE_TXT.Text = TimeRNG