1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| Private Function Read_choix_type(Index As Integer, Var_Poids_faible As Integer, Var_Poids_Fort As Integer) As Single
'Fonction permettant de lire un mot, un double mot ou un flottant
Dim Var_low As Integer
Dim Var_Hight As Integer
Dim Var_total As Single
Dim bool_control_decimal As Boolean
Var_low = 0
Var_Hight = 0
Var_total = 0
'On Error GoTo error0
'Calcul un double mot
Dim S2 As Object
Set S2 = CreateObject("Conversion.Int_float")
S2.choix_resultat = Index
Select Case S2.choix_resultat
Case 0
'Cells(Selection.Row, 4) = S2.Result_0_Mot_simple
'Mot
Var_total = Var_low
Case 1
'Double mot
S2.Poids_faible = Var_Poids_faible
S2.Poids_fort = Var_Poids_Fort
S2.Conv_mots_octets
Var_total = S2.Result_1_Mot_double
Case 2
'Flottant
S2.Poids_faible = Var_Poids_Fort
S2.Poids_fort = Var_Poids_faible
S2.Conv_mots_octets
bool_control_decimal = IsNumeric(S2.Result_2_Flottant)
If bool_control_decimal Then
Var_total = S2.Result_2_Flottant
Else
Var_total = Val(S2.Result_2_Flottant)
End If
End Select
Set S2 = Nothing
Read_choix_type = Var_total
Exit Function
error0:
Var_total = 0 'recup_data_PLC_present_HP(Var_Poids_faible)
End Function |
Partager