I am creating a learning system for children through cards that have an animal and a bar code. The idea is to play an initial video, in LOOP, asking the child to choose a card and pass it through the reader. Then the system shows you a video of that animal, and returns to the initial video, again in LOOP, waiting for a new card. On Sheet1, I have column A with the barcodes, and column B with the file names. The system searches in col A for the code entered with the bar code, and plays the file for the col B
So far, when I open the excel, start the initial video in LOOP, position the cursor in the combobox, and when reading a card, the corresponding video is played, empty the combobox and the cursor is repositioned in the combobox What I can not do is that at the end of it, play the initial video again in LOOP.
This is the code:
Private Sub Workbook_Open()
UserForm1.Show
End Sub
Private Sub ComboBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
'si el control queda vacío no se ejecuta
If ComboBox1 = "" Then Exit Sub
'carpeta donde estarán los videos
videos = "C:\Users\LOSBOA\videos\"
'se busca el cod en col A de la hoja activa
Set busco = ActiveSheet.Range("A:A").Find(Val(ComboBox1), LookIn:=xlValues, lookat:=xlWhole)
'si no encuentra el código cancela
If busco Is Nothing Then
Cancel = True
ComboBox1 = "": ComboBox1.SetFocus: Exit Sub
End If
Set ext = ActiveSheet.Range("D1")
elvideo = busco.Offset(0, 1)
'contempla posible error
On Error Resume Next
WindowsMediaPlayer1.URL = videos & elvideo & ext
Cancel = True
ComboBox1 = "": ComboBox1.SetFocus
End Sub
Private Sub WindowsMediaPlayer1_OpenStateChange(ByVal NewState As Long)
On Error Resume Next
WindowsMediaPlayer1.fullScreen = False
WindowsMediaPlayer1.settings.setMode "loop", True
End Sub
Private Sub UserForm_Initialize()
ComboBox1.SetFocus 'ajustar el nombre del control
End Sub
Thank you very much for your help