Home > Community > Automation and VBA > Liste déroulante avec objet différent en VBA > Antwort auf: Liste déroulante avec objet différent en VBA

#8601
Bernhard KantzBernhard Kantz
Teilnehmer

Try this code:


    ActiveDatabase.ActiveObject.Cursor(fpCursorMinX).Active = True
    p1 = ActiveDatabase.ActiveObject.ActiveCursor.PositionIndex
    ActiveDatabase.ActiveObject.Cursor(fpCursorMaxX).Active = True
    p2 = ActiveDatabase.ActiveObject.ActiveCursor.PositionIndex
    ActiveDatabase.ActiveObject.CursorActive = False

    Dim Moy As StatisticQuantityAnalysis
    Set Moy = ActiveDatabase.ActiveFolder.Add("Moy", fpObjectTypeStatisticQuantity)
    With Moy
        .DataSet = "beber[" & CStr(p1) & "," & CStr(p2) & "]"
        .Quantity = fpStatisticQuantityArithmeticMean
        .Update
    End With

But in this case it’s easier to use FPScript instead of VBA!

1) Create a FPScript formula ‘beberSection’:


(beber)[Diagram.2D.Cursor(fpCursorMinX, 1).PositionIndex, Diagram.2D.Cursor(fpCursorMaxX, 1).PositionIndex]

2) Create a Mean analysis object with the data set ‘beberSection’.

If you change the position of the cursors FlexPro automatically recalculates the mean value of the new data part.

support@weisang.com