Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Play Sound File Once when cell value condition id met

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default Play Sound File Once when cell value condition id met

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Play Sound File Once when cell value condition id met

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default Play Sound File Once when cell value condition id met

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Play Sound File Once when cell value condition id met

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
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
play sound when pressing commandbutton Hoyos Excel Discussion (Misc queries) 1 August 19th 07 04:12 PM
Making a sound on condition of textbox damorrison Excel Discussion (Misc queries) 4 September 4th 06 11:41 PM
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
Can you auto-trigger a sound file to play when a worksheet opens? Nanotexan Excel Worksheet Functions 1 February 5th 06 05:16 PM
How do you add sound file to a cell in excel Martin Excel Worksheet Functions 9 May 2nd 05 01:12 AM


All times are GMT +1. The time now is 06:30 AM.

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

About Us

"It's about Microsoft Excel"