Bonjour,
Je viens de créer un userform qui me permet de sélectionner une option parmis plusieurs et qui est sensé ensuite ouvrir un mail et remplir plusieurs information dans ce mail selon l'option choisis.
Voici le Userform et le code associé :
Private Sub activer()
i = 3
If choix <> "" Then
'CommandButton1.Enabled = True
'CommandButton1.Caption = "Valider le choix"
Do Until Sheets("Parametre").Cells(i, 4).Value = ""
If Sheets("Parametre").Cells(i, 4).Value = titre Then
Dim LeMail As Variant
Set LeMail = CreateObject("Outlook.Application")
With LeMail.CreateItem(olMailItem)
.Subject = Sheets("Parametre").Cells(i, 5).Value
.To = Sheets("Session").Range("EG18")
.Body = Sheets("Parametre").Cells(i, 6).Value
.display
End With
Exit Do
Else
End If
i = i + 1
Loop
End If
End Sub
---------------------------------------------------------------------------------------------
Private Function choix()
For Each bouton_choix In Frame_choix.Controls
If bouton_choix.Value Then
choix = bouton_choix.Caption
End If
Next
End Function
-----------------------------------------------------------------------------------------------------
Private Sub OptionButton1_Click()
titre = Label1.Caption
activer
End Sub
-----------------------------------------------------------------------------------------------
Private Sub OptionButton2_Click()
titre = Label2.Caption
activer
End Sub
-----------------------------------------------------------------------------------------------
Private Sub OptionButton3_Click()
titre = Label3.Caption
activer
End Sub
Lorsque je lance la macro, elle m'affiche bien mon userform, et lorsque je clique dans l'une des trois option, j'ai un :
ET il reste bloqué sur une ligne "if"
Quelqu'un peut-il me dire où est l'erreur ?
Merci à vous par avance.