Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro for Opening Reuters, Opening Excel File, Closing Excel File | Excel Programming | |||
Load text file into memory for searching? | Excel Programming | |||
Opening a browse and load file box in a macro | Excel Programming | |||
Microsoft Excel tries to load front page on opening | Excel Discussion (Misc queries) | |||
opening a word document from excel: file still won't load | Excel Programming |