Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Macro to Play Wave File

I have a macro to play a wave file. It works great (See code below) but,
the macro won't play my wave file all the way through to the end. It plays
about 5 - 10 seconds of the file and that is about it.
Does anyone have any idea on how to make the macro play the entire file
all the way through?
TIA

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 folder\my subfolder\wav1.wav", 0, &H20000)
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Macro to Play Wave File

Try this:

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

Sub PlayMe1()
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000
Dim retval As Long
retval = PlaySound("C:\My folder\my subfolder\wav1.wav", _
0, SND_ASYNC Or SND_FILENAME)
End Sub


--
Regards,
Tom Ogilvy


yo beee wrote in message
...
I have a macro to play a wave file. It works great (See code below)

but,
the macro won't play my wave file all the way through to the end. It plays
about 5 - 10 seconds of the file and that is about it.
Does anyone have any idea on how to make the macro play the entire

file
all the way through?
TIA

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 folder\my subfolder\wav1.wav", 0, &H20000)
End Sub




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Macro to Play Wave File

Tom,
Thanks! It worked perfectly. Any ideas on how to stop all wav files with
a command button?
Thanks again. Your a lifesaver!
yobeee
"Tom Ogilvy" wrote in message
...
Try this:

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

Sub PlayMe1()
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000
Dim retval As Long
retval = PlaySound("C:\My folder\my subfolder\wav1.wav", _
0, SND_ASYNC Or SND_FILENAME)
End Sub


--
Regards,
Tom Ogilvy


yo beee wrote in message
...
I have a macro to play a wave file. It works great (See code below)

but,
the macro won't play my wave file all the way through to the end. It

plays
about 5 - 10 seconds of the file and that is about it.
Does anyone have any idea on how to make the macro play the entire

file
all the way through?
TIA

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 folder\my subfolder\wav1.wav", 0, &H20000)
End Sub






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Macro to Play Wave File

Untested, but you can try this:

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

Sub StopMe1()
Const SND_PURGE = &H40
Dim retval As Long
retval = PlaySound(vbNullString, _
0, SND_PURGE = &H40)
End Sub

You don't need to repeat the declaration if it is already in the module.

--
Regards,
Tom Ogilvy


yo beee wrote in message
...
Tom,
Thanks! It worked perfectly. Any ideas on how to stop all wav files

with
a command button?
Thanks again. Your a lifesaver!
yobeee
"Tom Ogilvy" wrote in message
...
Try this:

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

Sub PlayMe1()
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000
Dim retval As Long
retval = PlaySound("C:\My folder\my subfolder\wav1.wav", _
0, SND_ASYNC Or SND_FILENAME)
End Sub


--
Regards,
Tom Ogilvy


yo beee wrote in message
...
I have a macro to play a wave file. It works great (See code

below)
but,
the macro won't play my wave file all the way through to the end. It

plays
about 5 - 10 seconds of the file and that is about it.
Does anyone have any idea on how to make the macro play the entire

file
all the way through?
TIA

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 folder\my subfolder\wav1.wav", 0,

&H20000)
End Sub








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I play a .WAV file in Excel if a condition is met? Roy Excel Worksheet Functions 3 April 27th 06 07:24 PM
How can i play a wave file in excel? pj Excel Discussion (Misc queries) 2 November 25th 05 07:36 PM
How do I enter a wave sound file into an excel cell? dkimball Excel Discussion (Misc queries) 2 March 28th 05 08:35 PM
Macro to play wave file yo beee Excel Programming 1 October 29th 03 11:42 PM
Button for wave file Vasant Nanavati Excel Programming 6 October 24th 03 03:44 PM


All times are GMT +1. The time now is 09:02 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"