Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Playing wavfiles from excel

I have

Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal
lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000

and then a series of:
Sub G02_WAV_AIR()
Dim WAVFile1 As String
WAVFile1 = "C:\0. QUO VADIS\SOUNDS\AIR.wav"
Call PlaySound(WAVFile1, 0&, SND_ASYNC Or SND_FILENAME)
End Sub

Each one gets it's own WAVfile#. Now this all worked perfectly until a few
weeks ago. Now, it will intermittently play only the first tenth of a second
of WAVs if they are at the start of a subroutine (subsequent statements of
ANY kind seem to terminate it). Other times (in the SAME subroutine, and
without code changes) it will play completely. If the WAV is at the end of a
sub then it always plays fully.

Is there something that needs to be cleared (or whatever) before playing a
WAV? Brett


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Playing wavfiles from excel

Brett, the below link may be helpful

http://www.mrexcel.com/archive/VBA/11357.html

If this post helps click Yes
---------------
Jacob Skaria


"Brett" wrote:

I have

Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal
lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000

and then a series of:
Sub G02_WAV_AIR()
Dim WAVFile1 As String
WAVFile1 = "C:\0. QUO VADIS\SOUNDS\AIR.wav"
Call PlaySound(WAVFile1, 0&, SND_ASYNC Or SND_FILENAME)
End Sub

Each one gets it's own WAVfile#. Now this all worked perfectly until a few
weeks ago. Now, it will intermittently play only the first tenth of a second
of WAVs if they are at the start of a subroutine (subsequent statements of
ANY kind seem to terminate it). Other times (in the SAME subroutine, and
without code changes) it will play completely. If the WAV is at the end of a
sub then it always plays fully.

Is there something that needs to be cleared (or whatever) before playing a
WAV? Brett


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Playing wavfiles from excel

Thank you Jacob. That's different code to what I have so I'll play around
with it later.

"Jacob Skaria" wrote:

Brett, the below link may be helpful

http://www.mrexcel.com/archive/VBA/11357.html

If this post helps click Yes
---------------
Jacob Skaria


"Brett" wrote:

I have

Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal
lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000

and then a series of:
Sub G02_WAV_AIR()
Dim WAVFile1 As String
WAVFile1 = "C:\0. QUO VADIS\SOUNDS\AIR.wav"
Call PlaySound(WAVFile1, 0&, SND_ASYNC Or SND_FILENAME)
End Sub

Each one gets it's own WAVfile#. Now this all worked perfectly until a few
weeks ago. Now, it will intermittently play only the first tenth of a second
of WAVs if they are at the start of a subroutine (subsequent statements of
ANY kind seem to terminate it). Other times (in the SAME subroutine, and
without code changes) it will play completely. If the WAV is at the end of a
sub then it always plays fully.

Is there something that needs to be cleared (or whatever) before playing a
WAV? Brett


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Playing wavfiles from excel

THIS POST IS NO LONGER REQUIRED.

"Brett" wrote:

Thank you Jacob. That's different code to what I have so I'll play around
with it later.

"Jacob Skaria" wrote:

Brett, the below link may be helpful

http://www.mrexcel.com/archive/VBA/11357.html

If this post helps click Yes
---------------
Jacob Skaria


"Brett" wrote:

I have

Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal
lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000

and then a series of:
Sub G02_WAV_AIR()
Dim WAVFile1 As String
WAVFile1 = "C:\0. QUO VADIS\SOUNDS\AIR.wav"
Call PlaySound(WAVFile1, 0&, SND_ASYNC Or SND_FILENAME)
End Sub

Each one gets it's own WAVfile#. Now this all worked perfectly until a few
weeks ago. Now, it will intermittently play only the first tenth of a second
of WAVs if they are at the start of a subroutine (subsequent statements of
ANY kind seem to terminate it). Other times (in the SAME subroutine, and
without code changes) it will play completely. If the WAV is at the end of a
sub then it always plays fully.

Is there something that needs to be cleared (or whatever) before playing a
WAV? Brett


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
Playing an audio file in Excel Fuji0664 Excel Discussion (Misc queries) 2 October 23rd 09 03:55 AM
Detecting the actual playing or NOT playing of a WAV file Bajbaj Excel Discussion (Misc queries) 0 October 24th 07 09:16 PM
Games not playing in Excel [email protected] Excel Discussion (Misc queries) 0 January 29th 07 10:32 PM
Playing a WAV file in Excel 2002 chalky[_9_] Excel Programming 7 January 24th 06 07:04 PM
Excel XP x Playing Sounds Paulo de Arruda Borelli Excel Programming 1 August 11th 03 07:51 PM


All times are GMT +1. The time now is 08:50 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"