Private Sub listbox1_Click()
Dim Chemin As String
Dim Chemin1 As String
Dim Photo As String
nl = Me.ListBox1.Column(2, Me.ListBox1.ListIndex)
For x = 0 To 12
Me.Controls("TextBox" & x + 1).Value = Sheets("Feuil1").Cells(nl, 1 + x)
Me.TextBox15.Value = Sheets("Feuil1").Cells(nl, 15)
Next x
With Me.TextBox1
.SelStart = 0
.SelLength = Len(.Value)
End With
' ****************************************************
' Indiques exactement le répertoire de tes images
' ****************************************************
Chemin = ThisWorkbook.Path & "/affiches/"
Chemin1 = ThisWorkbook.Path & "/drapeaux/"
Photo = Dir(Chemin & Me.ListBox1.Text & ".jpg")
If Photo <> "" Then
With Me.Image1
.Picture = LoadPicture(Chemin & Me.ListBox1.Text & ".jpg") 'Si la photo existe
End With
Else
With Me.Image1
.Picture = LoadPicture(Chemin & "NotFound.jpg") 'Si elle n'existe pas ! on met L'image prévue à cette fin !
End With
End If
If Me.TextBox15 <> "" Then
Photo = Dir(Chemin1 & Me.TextBox15.Text & ".gif")
If Photo <> "" Then
With Me.Image2
.Picture = LoadPicture(Chemin1 & Me.TextBox15.Text & ".gif") 'Si la photo existe
End With
Else
With Me.Image2
.Picture = LoadPicture(Chemin1 & "NotFound.gif") 'Si elle n'existe pas ! on met L'image prévue à cette fin !
End With
End If
Else
Me.Image2.Picture = LoadPicture(Chemin1 & "NotFound.gif")
End If
End Sub
Correction bestiale qui n'empêche pas l’exécution :Pourquoi le film 300 ne passe pas.
Quel code faut t'il mettre pour le lecteur windows media ?
Merci.
Pour Windows média : création d'un bouton supplémentairePrivate Sub listbox1_Click()
Dim Chemin As String
Dim Chemin1 As String
Dim Chemin2 As String
Dim Chemin3 As String
Dim Chemin4 As String
' ****************************************************
' Indiques exactement le répertoire de tes images
' ****************************************************
Chemin = ThisWorkbook.Path & "\affiches\"
Chemin1 = ThisWorkbook.Path & "\drapeaux\"
Chemin2 = ThisWorkbook.Path & "\acteurs\"
Chemin3 = ThisWorkbook.Path & "\acteurs1\"
Chemin4 = ThisWorkbook.Path & "\acteurs2\"
For x = 0 To 5
Next x
On Error Resume Next
Me.Image1.Picture = LoadPicture(Chemin & Me.ListBox1 & ".jpg")
Me.Image2.Picture = LoadPicture(Chemin1 & Me.ListBox1 & ".gif")
Me.Image3.Picture = LoadPicture(Chemin2 & Me.ListBox1 & ".jfif")
Me.Image4.Picture = LoadPicture(Chemin3 & Me.ListBox1 & ".jfif")
Me.Image5.Picture = LoadPicture(Chemin4 & Me.ListBox1 & ".jfif")
On Error GoTo 0
nl = Me.ListBox1.Column(2, Me.ListBox1.ListIndex)
For x = 0 To 12
Me.Controls("TextBox" & x + 1).Value = Sheets("Feuil1").Cells(nl, 1 + x)
Next x
With Me.TextBox1
.SelStart = 0
.SelLength = Len(.Value)
End With
With Me.WindowsMediaPlayer1
.Url = "Nom Du film et son chemin dans la table"
CommandButton3.Visible = True
CommandButton3_Click
End With
End Sub
Private Sub CommandButton3_Click()
Dim Fin As Date
With Me.WindowsMediaPlayer1
Fin = Time + TimeValue("00:00:05") ' 5 secondes pour être accessible
Do While .playState = wmppsTransitioning And Time < Fin
DoEvents
Loop
Select Case True
Case .playState = wmppsReady
Me.CommandButton3.Caption = "Play"
Case .Controls.isAvailable("Pause"):
.Controls.pause
Me.CommandButton3.Caption = "Play"
Case .Controls.isAvailable("Play"):
.Controls.Play
Me.CommandButton3.Caption = "Pause"
End Select
End With
End Sub