bonsoir le forum,
je viens vers vous afin de vous demander de m'aidez, j'ai créer un userform avec une combobox et CommandButton1,
je souhaite une fois sélectionner le nom sur le combobox il m'ouvre le PDF qui correspond au nom choisi.
je souhaite mettre plus de CommandButton1 est je ne sais pas comment procéder
merci encore
je viens vers vous afin de vous demander de m'aidez, j'ai créer un userform avec une combobox et CommandButton1,
je souhaite une fois sélectionner le nom sur le combobox il m'ouvre le PDF qui correspond au nom choisi.
je souhaite mettre plus de CommandButton1 est je ne sais pas comment procéder
Code:
Private Sub ComboBox1_Change()
Dim Ligne As Long
Dim i As Integer
If Me.ComboBox1.ListIndex = -1 Then Exit Sub
Ligne = Me.ComboBox1.ListIndex + 2
For i = 1 To 20
Next i
End Sub
Private Sub CommandButton1_Click()
Application.Visible = True
UserForm1.Hide
End Sub
Public Sub openPDF(ByVal cheminPDF As String)
Dim Shex As Object
Set Shex = CreateObject("Shell.Application")
If Dir(cheminPDF) = "" Then
MsgBox "Fichier suivant non trouvé:" & vbCr & cheminPDF
Else
Shex.Open (cheminPDF)
End If
End Sub
Private Sub CommandButton2_Click()
Dim Ligne As Long
Dim i As Integer
If Me.ComboBox1.ListIndex = -1 Then Exit Sub 'On sort si pas de sélection
Ligne = Me.ComboBox1.ListIndex + 2
openPDF Sheets("Données").Cells(Ligne, 3).Value
End Sub
merci encore