Je le copie ici (et oui,on nous demande de le faire sous open office ou access,ne me demander pas pourquoi!)
sub main Calculatrice
Dim byteoperation As Byte
Dim typeoperation As Byte
Dim nbr1 As Double
Dim nbrvrg As Byte
Dim fctr As Double
Sub CommandButton18_Click()
If label.Caption <> 0 Then
label.Caption = 1 / label.Caption
Else
MsgBox "Division par zéro impossible"
End If
End Sub
Private Sub CommandButton21_Click()
For i = 1 To Len(label)
If Mid(label, i, 1) = "." Then
nbrvrg = nbrvrg + 1
End If
Next i
If nbrvrg = 0 Then
label = label & "."
Else
label = label
End If
nbrvrg = 0
End Sub
Private Sub CommandButton24_Click()
byteoperation = 5
If typeoperation = 1 Then
label = label + nbr1
Else
If typeoperation = 2 Then
label = -1 * label + nbr1
Else
If typeoperation = 3 Then
label = label * nbr1
Else
If typeoperation = 4 Then
If label <> 0 Then
label = nbr1 / label
Else
MsgBox "Division par zéro impossible"
End If
End If
End If
End If
End If
End Sub
Private Sub CommandButton30_Click()
label = 0
End Sub
Private Sub CommandButton6_Click()
If label.Caption >= 0 Then
label.Caption = (label.Caption) ^ 0.5
Else
MsgBox "ce nombre doit être positive"
End If
End Sub
Private Sub fct_Click()
fctr = 1
For i = 1 To label.Caption
fctr = fctr * i
Next i
label.Caption = fctr
End Sub
Private Sub op1_Click()
typeoperation = 1
byteoperation = 1
nbr1 = label.Caption
End Sub
Private Sub op2_Click()
typeoperation = 2
byteoperation = 2
nbr1 = label.Caption
End Sub
Private Sub op3_Click()
typeoperation = 3
byteoperation = 3
nbr1 = label.Caption
End Sub
Private Sub op4_Click()
typeoperation = 4
byteoperation = 4
nbr1 = label.Caption
End Sub
Private Sub commande1_Click()
If byteoperation = 0 Then
label.Caption = label.Caption & 1
Else
label.Caption = 1
byteoperation = 0
End If
End Sub
Private Sub commande2_Click()
If byteoperation = 0 Then
label.Caption = label.Caption & 2
Else
label.Caption = 2
byteoperation = 0
End If
End Sub
Private Sub commande3_Click()
If byteoperation = 0 Then
label.Caption = label.Caption & 3
Else
label.Caption = 3
byteoperation = 0
End If
End Sub
Private Sub commande4_Click()
If byteoperation = 0 Then
label.Caption = label.Caption & 4
Else
label.Caption = 4
byteoperation = 0
End If
End Sub
Private Sub commande5_Click()
If byteoperation = 0 Then
label.Caption = label.Caption & 5
Else
label.Caption = 5
byteoperation = 0
End If
End Sub
Private Sub commande6_Click()
If byteoperation = 0 Then
label.Caption = label.Caption & 6
Else
label.Caption = 6
byteoperation = 0
End If
End Sub
Private Sub commande7_Click()
If byteoperation = 0 Then
label.Caption = label.Caption & 7
Else
label.Caption = 7
byteoperation = 0
End If
End Sub
Private Sub commande8_Click()
If byteoperation = 0 Then
label.Caption = label.Caption & 8
Else
label.Caption = 8
byteoperation = 0
End If
End Sub
Private Sub commande9_Click()
If byteoperation = 0 Then
label.Caption = label.Caption & 9
Else
label.Caption = 9
byteoperation = 0
End If
End Sub
Private Sub commande10_Click()
If byteoperation = 0 Then
label.Caption = label.Caption & 0
Else
label.Caption = 0
byteoperation = 0
End If
End Sub
Private Sub ra_Click()
If Len(label.Caption) <> 1 Then
label.Caption = Left(label.Caption, Len(label.Caption) - 1)
Else
label.Caption = 0
End If
End Sub
Private Sub siop_Click()
label.Caption = -label.Caption
End Sub