Private Declare Function mciExecute Lib "winmm.dll" (ByVal lpstrCommand As String) As Long
Private Sub Command1_Click()
autorepeat "f:\bg.MID", 9
End Sub
Sub autorepeat(ByVal midpath As String, ByVal n As Integer) 'play n times
For i = 1 To n
mciExecute "open " & midpath & " alias temp"
mciExecute "play temp wait"
mciExecute "close temp wait"
Next
End Sub