Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 152
Default Can I pre-load wav file into memory on opening excel wb?

Hi,
I have a workbook that I want to have play certain wav files as alerts.
These are not the windows standard wav files so whenever an even triggers a
wav aleart, excel has to open the file and then play it.

This slows things down as the mouse icon turns into the "hour-glass" for a
second.

Is there a way to have excel either run the playsound in the background or
preload the file into memory so there is no wait?

Thanks!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Can I pre-load wav file into memory on opening excel wb?


You can't preload the sound file. However, a sound can be played
synchronously or asynchronously. In synchronous sound, the code will
pause execution until the sound has complete playing, In asychronous
sound, the wav is sent to the function but code continues to execute
while the sound is playing. E.g,

Public Declare Function sndPlaySound32 _
Lib "winmm.dll" _
Alias "sndPlaySoundA" ( _
ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long

Const PLAY_SOUND_SYNC As Long = 0& ' wait for completion
Const PLAY_SOUND_ASYNC As Long = 1& ' do not wait

Sub AAA()
sndPlaySound32 "C:\Windows\Media\chimes.wav", ASYNC
End Sub



Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)




On Thu, 24 Sep 2009 21:58:01 -0700, MikeZz
wrote:

Hi,
I have a workbook that I want to have play certain wav files as alerts.
These are not the windows standard wav files so whenever an even triggers a
wav aleart, excel has to open the file and then play it.

This slows things down as the mouse icon turns into the "hour-glass" for a
second.

Is there a way to have excel either run the playsound in the background or
preload the file into memory so there is no wait?

Thanks!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 152
Default Can I pre-load wav file into memory on opening excel wb?

Hi Chip,
At first I was having difficulties but figured it out.
Your solution works perfectly as usual!

The only problem I have now is that the "KeepTime" and "AlarmSound"
functions I've found on the internet cause the mouse to blink to an hourglass
for just a fraction of a second. It doesn't seem to interupt the mouse
enough to mess with the functionality... but it's darn right agitating to see
it blink for that fraction of a second.

Any ideas on fixing that problem would be just fantastic!

Thanks again for the great assistance!

MikeZz


"Chip Pearson" wrote:


You can't preload the sound file. However, a sound can be played
synchronously or asynchronously. In synchronous sound, the code will
pause execution until the sound has complete playing, In asychronous
sound, the wav is sent to the function but code continues to execute
while the sound is playing. E.g,

Public Declare Function sndPlaySound32 _
Lib "winmm.dll" _
Alias "sndPlaySoundA" ( _
ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long

Const PLAY_SOUND_SYNC As Long = 0& ' wait for completion
Const PLAY_SOUND_ASYNC As Long = 1& ' do not wait

Sub AAA()
sndPlaySound32 "C:\Windows\Media\chimes.wav", ASYNC
End Sub



Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)




On Thu, 24 Sep 2009 21:58:01 -0700, MikeZz
wrote:

Hi,
I have a workbook that I want to have play certain wav files as alerts.
These are not the windows standard wav files so whenever an even triggers a
wav aleart, excel has to open the file and then play it.

This slows things down as the mouse icon turns into the "hour-glass" for a
second.

Is there a way to have excel either run the playsound in the background or
preload the file into memory so there is no wait?

Thanks!


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
Macro for Opening Reuters, Opening Excel File, Closing Excel File Tsp245 Excel Programming 2 August 14th 08 07:24 PM
Load text file into memory for searching? J@Y Excel Programming 12 July 5th 07 03:21 AM
Opening a browse and load file box in a macro Scott Calkins via OfficeKB.com Excel Programming 2 May 25th 05 10:56 PM
Microsoft Excel tries to load front page on opening Excel and Front Page Excel Discussion (Misc queries) 1 March 21st 05 08:51 PM
opening a word document from excel: file still won't load chris Excel Programming 2 April 1st 04 12:05 PM


All times are GMT +1. The time now is 12:26 AM.

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"