ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to play wave file (https://www.excelbanter.com/excel-programming/280887-macro-play-wave-file.html)

yo beee

Macro to play wave file
 
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



Greg Koppel

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






All times are GMT +1. The time now is 11:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com