Macro to play wave file

  • Thread starter Thread starter yo beee
  • Start date Start date
Y

yo beee

Vasant helped me with the code below and it works great. It's designed to
play a wave file. Problem is, I want it to play a long wave file - about 1
minute long all the way through to the end, but it only plays about 10 sec.
Any ideas?
TIA
yobeee

Declare Function PlaySound Lib "winmm.dll" _
Alias "PlaySoundA" (ByVal lpszName As String, _
ByVal hModule As Long, _
ByVal dwFlags As Long) As Long

Sub PlayMe1()
Dim retval As Long
retval = PlaySound("C:\my documents\my folder\wav1.wav", 0, &H20000)
End Sub
 
First embed the wav file in Excel by Insert/Object/Create from file

Sub MusicDemo()
Worksheets("sheet1").OLEObjects(1).Verb
End Sub

Verb is a generic metehod that uses the appropriate associated program for
an object embedded in Excel.

HTH, Greg
 
Back
Top