View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Greg Koppel Greg Koppel is offline
external usenet poster
 
Posts: 79
Default Macro to play wave file

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

"yo beee" wrote in message
...
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