Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Could someone please explain how I get a sound file to run once the value in
a cell exceeds a specific value. The cell value contains realtime data and, therefore, I would only want it to play once (or twice) and then wait until I reset thee trigger value Thanks in advance, John |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
This requires macros... I assume you are OK with macros??? How is you comfort
level with macros written from scratch... Next you need to define real time data... where is the data coming from and does it trigger the change event in XL or is there some kind of update routine that can be captured. -- HTH... Jim Thomlinson "John 1" wrote: Could someone please explain how I get a sound file to run once the value in a cell exceeds a specific value. The cell value contains realtime data and, therefore, I would only want it to play once (or twice) and then wait until I reset thee trigger value Thanks in advance, John |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I am only OK with basic macros.
I have the code from a previous thread in 2006 but once triggered the sound continues to loop and will not stop until the value goes below the trigger level. ............... Option Explicit Private Declare Function sndPlaySound32 Lib "winmm.dll" Alias _ "sndPlaySoundA" (ByVal lpszSoundName As String, _ ByVal uFlags As Long) As Long Private Sub Worksheet_Calculate() If Me.Range("b2").Value 200 Then sndPlaySound32 "G:\DATA\scans\New Position.wav", 0 End If End Sub ................................. Just need to be able to stop after played once or twice???????????? Thanks, John "Jim Thomlinson" wrote: This requires macros... I assume you are OK with macros??? How is you comfort level with macros written from scratch... Next you need to define real time data... where is the data coming from and does it trigger the change event in XL or is there some kind of update routine that can be captured. -- HTH... Jim Thomlinson "John 1" wrote: Could someone please explain how I get a sound file to run once the value in a cell exceeds a specific value. The cell value contains realtime data and, therefore, I would only want it to play once (or twice) and then wait until I reset thee trigger value Thanks in advance, John |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Give this a whirl...
Private Declare Function sndPlaySound32 Lib "winmm.dll" Alias _ "sndPlaySoundA" (ByVal lpszSoundName As String, _ ByVal uFlags As Long) As Long Private m_lngReset As Long Private Sub Worksheet_Calculate() If Me.Range("b2").Value 200 And m_lngReset < 2 Then 'you can change the 2 sndPlaySound32 "G:\DATA\scans\New Position.wav", 0 m_lngReset = m_lngReset + 1 End If End Sub 'Run this to reset the sound Public Sub ResetSound() m_lngReset = 0 End Sub -- HTH... Jim Thomlinson "John 1" wrote: I am only OK with basic macros. I have the code from a previous thread in 2006 but once triggered the sound continues to loop and will not stop until the value goes below the trigger level. .............. Option Explicit Private Declare Function sndPlaySound32 Lib "winmm.dll" Alias _ "sndPlaySoundA" (ByVal lpszSoundName As String, _ ByVal uFlags As Long) As Long Private Sub Worksheet_Calculate() If Me.Range("b2").Value 200 Then sndPlaySound32 "G:\DATA\scans\New Position.wav", 0 End If End Sub ................................ Just need to be able to stop after played once or twice???????????? Thanks, John "Jim Thomlinson" wrote: This requires macros... I assume you are OK with macros??? How is you comfort level with macros written from scratch... Next you need to define real time data... where is the data coming from and does it trigger the change event in XL or is there some kind of update routine that can be captured. -- HTH... Jim Thomlinson "John 1" wrote: Could someone please explain how I get a sound file to run once the value in a cell exceeds a specific value. The cell value contains realtime data and, therefore, I would only want it to play once (or twice) and then wait until I reset thee trigger value Thanks in advance, John |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thanks Jim, appreciate that........ will give it a go on Monday but looks
good to me. As a point of interest is there a place where I can find the necessary variables (eg m_lngReset ) and the functions to call? Is there a way to run the ResetSound routine directly from the worksheet? Cheers, John "Jim Thomlinson" wrote: Give this a whirl... Private Declare Function sndPlaySound32 Lib "winmm.dll" Alias _ "sndPlaySoundA" (ByVal lpszSoundName As String, _ ByVal uFlags As Long) As Long Private m_lngReset As Long Private Sub Worksheet_Calculate() If Me.Range("b2").Value 200 And m_lngReset < 2 Then 'you can change the 2 sndPlaySound32 "G:\DATA\scans\New Position.wav", 0 m_lngReset = m_lngReset + 1 End If End Sub 'Run this to reset the sound Public Sub ResetSound() m_lngReset = 0 End Sub -- HTH... Jim Thomlinson "John 1" wrote: I am only OK with basic macros. I have the code from a previous thread in 2006 but once triggered the sound continues to loop and will not stop until the value goes below the trigger level. .............. Option Explicit Private Declare Function sndPlaySound32 Lib "winmm.dll" Alias _ "sndPlaySoundA" (ByVal lpszSoundName As String, _ ByVal uFlags As Long) As Long Private Sub Worksheet_Calculate() If Me.Range("b2").Value 200 Then sndPlaySound32 "G:\DATA\scans\New Position.wav", 0 End If End Sub ................................ Just need to be able to stop after played once or twice???????????? Thanks, John "Jim Thomlinson" wrote: This requires macros... I assume you are OK with macros??? How is you comfort level with macros written from scratch... Next you need to define real time data... where is the data coming from and does it trigger the change event in XL or is there some kind of update routine that can be captured. -- HTH... Jim Thomlinson "John 1" wrote: Could someone please explain how I get a sound file to run once the value in a cell exceeds a specific value. The cell value contains realtime data and, therefore, I would only want it to play once (or twice) and then wait until I reset thee trigger value Thanks in advance, John |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
play sound when pressing commandbutton | Excel Discussion (Misc queries) | |||
Making a sound on condition of textbox | Excel Discussion (Misc queries) | |||
How can I play a .WAV file in Excel if a condition is met? | Excel Worksheet Functions | |||
Can you auto-trigger a sound file to play when a worksheet opens? | Excel Worksheet Functions | |||
How do you add sound file to a cell in excel | Excel Worksheet Functions |