stopping Windows Media Player using VBA
I've been trying to write some code which will start playing an audio file and then stop after a certain number of seconds. I've tried this:-
sub testcode () Dim wmp as WindowsMediaPlayer Set wmp = New WindowsMediaPlayer wmp.URL = "C:\audio\test.mp3" wmp openPlayer (wmp.URL) Application.Wait Now() + TimeSerial(0, 0, 10) wmp.Controls.stop End Sub It opens the player ok and plays the file but then it doesn't stop after 10 sec. wmp.playState tells me it is stopped - but the player keeps going. Is wmp.Controls.stop the wrong command? I'm not too experienced with this sort of thing so I may be making a really silly mistake. Can anyone tell me what it is? |
All times are GMT +1. The time now is 12:30 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com