PDA

View Full Version : Need audio player to be embedded in form



shankar
10-29-2010, 04:25 AM
I need an audio player applet (with play, stop, pause, rewind buttons and position slider) to be embedded in a form in VBA.

Is there a ready-made solution available such as Active-X or Java? Thanks.

Shankar

Kenneth Hobs
10-29-2010, 06:33 PM
Since most will have Windows MediaPlayer, use that.
e.g. Replace WAV file with yours.
Private Sub UserForm_Initialize()
Dim newMedia
With WindowsMediaPlayer1
.settings.requestMediaAccessRights ("full")
'open up playlist called excel
.playlistCollection.getByName ("Excel")
'make sure playlist is empty
.currentPlaylist.Clear
'add the first file to play
Set newMedia = .newMedia("c:\myfiles\excel\sound\boooo.wav")
.currentPlaylist.insertItem 0, newMedia
'start playing
.Controls.Play
End With
End Sub

shankar
10-30-2010, 09:07 PM
Thanks. Will try and let you know.

shankar
10-31-2010, 06:01 AM
I didn't realize that WMP was in the 'additional controls' of the form toolbox.

However when I try to drag the WMP from the toolbox to my form, Excel crashes.

I tried with Word, it crashes too.

I have Office 2010 installed and am running it under Windows 7.

Trying to figure out the reason it is crashing.

Kenneth Hobs
10-31-2010, 06:17 AM
To resolve wmp errors, see: http://www.updatexp.com/wmpdll.html

or

http://social.answers.microsoft.com/Forums/en-US/w7pictures/thread/a1ec7674-9967-49d9-8890-acad3a695798