Auto Scaling problem

Auto Scaling problem

Hello,
I am new in this forum
I work on a Zenon supervision project
I have a question concerning the implementation of the Auto Scaling of curves in vba,
I would like to retrieve the min and max date in the curve display before I can look in the archives the maximum value of the variable,
Here are a few lines of code that I do,
Thank you in advance for your reply,
//-------------------------------------------vba code----------------------------------------
Public Sub autoSCale()
Dim obFctTrend As RtFunction
Dim strDynProp As String
Dim iCurves As Integer
dim vStart, vEnd as Date
Set obFctTrend = thisproject.RtFunctions.Item("Courbe")
For iCurves = 0 To obFctTrend.DynProperties("PictFilter.Curve[-1]")
strDynProp = "PictFilter.Curve[" & iCurves & "]"
If InStr(1, "Empty", obFctTrend.DynProperties(strDynProp & ".VarInfo.VarName")) = 0 Then

'She always give me the date value 01/01/1970 01:00:00
vStart = obFctTrend.DynProperties("PictFilter.TimeAxe.TimeFilter.ARVTime1")
'She always give me the date value 01/01/1970 02:00:00
EndDate = obFctTrend.DynProperties("PictFilter.TimeAxe.TimeFilter.ARVTime2")

'Search in the archives the min and max of the variable of the curve between the dates vStart and EndDate
updateMinMax (obFctTrend.DynProperties(strDynProp & ".VarInfo.VarName"), vStart, EndDate)
obFctTrend.DynProperties(strDynProp & ".XAxe.Scale.ScaleTop") = max
obFctTrend.DynProperties(strDynProp & ".XAxe.Scale.ScaleBotton") = min
obFctTrend.Start
End If
Next iCurves
End Sub

This is a migrated post! Originally posted on 29.09.2011 by user zenon. Please be aware that information can be outdated.