ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Assign a sound to a variable (https://www.excelbanter.com/excel-programming/448725-assign-sound-variable.html)

Howard

Assign a sound to a variable
 
This is a shortened list of sounds in column R, sheet 1. And is the list for a data validation drop down in H1.

C:\Windows\Media\ir_end.wav
C:\Windows\Media\ringout.wav
C:\Windows\Media\Speech Misrecognition.wav

This is in Module 1:

Option Explicit

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

Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_LOOP = &H8
Const SND_PURGE = &H40

Public Sub SoundPlayAsyncOnce(Sound As String)
'SND_SYNC to play assynchron
sndPlaySound Sound, SND_ASYNC
End Sub


This is in sheet1 vb editor:

Option Explicit

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

Sub TingleTunes()

'Dim iSnd As string
'Set iSnd = Range("H1").Value
'SoundPlayAsyncOnce iSnd.Value
'SoundPlayAsyncOnce iSnd.Value

SoundPlayAsyncOnce ActiveCell.Value
End Sub

As is, it works fine to select a sound in R column and run Sub TingleTunes().

The commented out code lines is my attempt to select a sound from the drop down and run TingleTunes to play the selected sound.

I get object required error.

Thanks.
Howard

Claus Busch

Assign a sound to a variable
 
Hi Howard,

Am Tue, 7 May 2013 23:56:21 -0700 (PDT) schrieb Howard:

The commented out code lines is my attempt to select a sound from the drop down and run TingleTunes to play the selected sound.


in a standard module:

Option Explicit
Private Declare Function sndPlaySound Lib "winmm.dll" _
Alias "sndPlaySoundA" (ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long

Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_LOOP = &H8
Const SND_PURGE = &H40

Public Sub SoundPlayAsyncOnce(Sound As String)
'SND_SYNC to play assynchron
sndPlaySound Sound, SND_ASYNC
End Sub

In the code module of sheet1:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$H$1" Then
SoundPlayAsyncOnce Target.Value
End If
End Sub


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2

Howard

Assign a sound to a variable
 
On Wednesday, May 8, 2013 12:10:07 AM UTC-7, Claus Busch wrote:
Hi Howard,



Am Tue, 7 May 2013 23:56:21 -0700 (PDT) schrieb Howard:



The commented out code lines is my attempt to select a sound from the drop down and run TingleTunes to play the selected sound.




in a standard module:



Option Explicit

Private Declare Function sndPlaySound Lib "winmm.dll" _

Alias "sndPlaySoundA" (ByVal lpszSoundName As String, _

ByVal uFlags As Long) As Long



Const SND_SYNC = &H0

Const SND_ASYNC = &H1

Const SND_LOOP = &H8

Const SND_PURGE = &H40



Public Sub SoundPlayAsyncOnce(Sound As String)

'SND_SYNC to play assynchron

sndPlaySound Sound, SND_ASYNC

End Sub



In the code module of sheet1:



Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = "$H$1" Then

SoundPlayAsyncOnce Target.Value

End If

End Sub





Regards

Claus Busch

--

Win XP PRof SP2 / Vista Ultimate SP2

Office 2003 SP2 /2007 Ultimate SP2


As simple as that!

Thanks, Claus.

Regards,
Howard

Claus Busch

Assign a sound to a variable
 
Hi Howard,

Am Wed, 8 May 2013 01:08:18 -0700 (PDT) schrieb Howard:

As simple as that!


sound is declared as string. And only objects will be set.
If you want play your complete list in A then you could try it so:

Sub Test()
Dim iSnd As String
Dim i As Long
For i = 1 To 10
iSnd = Cells(i, 1).Value
SoundPlayAsyncOnce iSnd
Application.Wait Now + TimeValue("00:00:02")
Next
End Sub


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2

Howard

Assign a sound to a variable
 
On Wednesday, May 8, 2013 1:12:20 AM UTC-7, Claus Busch wrote:
Hi Howard,



Am Wed, 8 May 2013 01:08:18 -0700 (PDT) schrieb Howard:



As simple as that!




sound is declared as string. And only objects will be set.

If you want play your complete list in A then you could try it so:



Sub Test()

Dim iSnd As String

Dim i As Long

For i = 1 To 10

iSnd = Cells(i, 1).Value

SoundPlayAsyncOnce iSnd

Application.Wait Now + TimeValue("00:00:02")

Next

End Sub





Regards

Claus Busch

--

Win XP PRof SP2 / Vista Ultimate SP2

Office 2003 SP2 /2007 Ultimate SP2


Thanks again, Claus.

That snippet is a nice little demo.

Regards,
Howard

CellShocked

Assign a sound to a variable
 
On Wed, 8 May 2013 10:12:20 +0200, Claus Busch
wrote:

Hi Howard,

Am Wed, 8 May 2013 01:08:18 -0700 (PDT) schrieb Howard:

As simple as that!


sound is declared as string. And only objects will be set.
If you want play your complete list in A then you could try it so:

Sub Test()
Dim iSnd As String
Dim i As Long
For i = 1 To 10
iSnd = Cells(i, 1).Value
SoundPlayAsyncOnce iSnd
Application.Wait Now + TimeValue("00:00:02")
Next
End Sub


Regards
Claus Busch



It would be cool if it could "play" in a similar fashion as that of
"BURG" the boot loader app for Linux distros and other PC operating
systems. It uses numeric values for the tone frequencies and duration
numerics for the time. My PC plays "Fur Elise" when it boots. If I used
it at work, I could tell if someone reboots a bench PC or such (until
they press a key anyway).

Howard

Assign a sound to a variable
 
Hi Claus,

I've got all codes and Public declares, Function etc... in place to play what ever is in "$H$1".

Below is a count down sub that works well on its own, and when the count down gets to whatever count down warning time selected by the user, the count down cell font turns red and continues counting down until 0, the enters "Time Up!"

I have tried to find a place in the count down code to place the equivalent
of "SoundPlayAsyncOnce Target.Value" so the code will play whatever is in
"$H$1" at the same time as the code turns the font red in the count down cell.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$H$1" Then
SoundPlayAsyncOnce Target.Value
End If
End Sub


Option Explicit
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Public Status As Boolean

Private Sub cmdStart_Click()
Status = True
Dim i As Integer
Dim WarningTime As Integer
Dim Period As Double
Dim MyTime As Double

With Sheets("Main")
If (.Cells(5, 1) = "") Then
WarningTime = .Cells(5, 4)
Else
WarningTime = .Cells(5, 1)
End If

If (.Cells(8, 1) = "") Then
Period = .Cells(8, 4)
Else
Period = .Cells(8, 1)
End If
End With

If (Period < 0.01) Then Period = 0.01

With Sheets("Counter").Cells(2, 1)

.FormatConditions.Delete
.FormatConditions.Add xlCellValue, xlLessEqual, WarningTime


With .FormatConditions(1).Font
.Bold = True
.ColorIndex = 3

End With
.NumberFormat = Choose(Log(Period) / Log(10) + 3, "0.00", "0.0", "0")

.Value = Sheets("Main").Cells(2, 1).Value + Period

Sheets("Counter").Activate
While (.Value Period And Status)
.Value = .Value - Period
MyTime = .Value
For i = 1 To 100 * Period
Sleep 10
MyTime = MyTime - 0.01
If (MyTime <= 0) Then Exit For
DoEvents
Next i
Wend
If (.Value <= Period) Then .Value = "Time Up!"
End With
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
If (Target.Row = 2 And Target.Column = 1) Then
Cells(5, 1).Value = Cells(5, 4).Value
End If
End Sub

Thanks.
Howard

Claus Busch

Assign a sound to a variable
 
Hi Howard,

Am Wed, 8 May 2013 12:37:55 -0700 (PDT) schrieb Howard:

I have tried to find a place in the count down code to place the equivalent
of "SoundPlayAsyncOnce Target.Value" so the code will play whatever is in
"$H$1" at the same time as the code turns the font red in the count down cell.


on which sheet is the button "Start"?

Private Sub Worksheet_Change(ByVal Target As Range)
If (Target.Row = 2 And Target.Column = 1) Then
Cells(5, 1).Value = Cells(5, 4).Value
End If
End Sub


and on which sheet is this Worksheet_Change-Event?


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2

Howard

Assign a sound to a variable
 
On Wednesday, May 8, 2013 11:14:21 PM UTC-7, Claus Busch wrote:
Hi Howard,



Am Wed, 8 May 2013 12:37:55 -0700 (PDT) schrieb Howard:



I have tried to find a place in the count down code to place the equivalent


of "SoundPlayAsyncOnce Target.Value" so the code will play whatever is in


"$H$1" at the same time as the code turns the font red in the count down cell.




on which sheet is the button "Start"?



Private Sub Worksheet_Change(ByVal Target As Range)


If (Target.Row = 2 And Target.Column = 1) Then


Cells(5, 1).Value = Cells(5, 4).Value


End If


End Sub




and on which sheet is this Worksheet_Change-Event?





Regards

Claus Busch

--

Win XP PRof SP2 / Vista Ultimate SP2

Office 2003 SP2 /2007 Ultimate SP2


Hi Claus,

Button START in on sheet named Main.

The Change Event code I posted here is NOT used in this case. I just posted it to sort of show that I wanted to play a sound (which I can choose from a drop down) and play it in the timer count down code I posted. Sorry, I sure did not make that clear.

To add, I can't find if this statement - SoundPlayAsyncOnce - will stop the code to play the sound or plays the sound while the code continues. There is another similar statement like this one and I cannot find where I read which was which. In the end, I prefer to keep code running and play sound.

Howard

Claus Busch

Assign a sound to a variable
 
Hi Howard,

Am Wed, 8 May 2013 23:39:17 -0700 (PDT) schrieb Howard:

Button START in on sheet named Main.

The Change Event code I posted here is NOT used in this case. I just posted it to sort of show that I wanted to play a sound (which I can choose from a drop down) and play it in the timer count down code I posted. Sorry, I sure did not make that clear.

To add, I can't find if this statement - SoundPlayAsyncOnce - will stop the code to play the sound or plays the sound while the code continues. There is another similar statement like this one and I cannot find where I read which was which. In the end, I prefer to keep code running and play sound.


try:
For i = 1 To 100 * Period
MyTime = MyTime - 0.01
SoundPlayAsyncOnce Sheets("Counter").Range("H1").Text
If (MyTime <= 0) Then Exit For
DoEvents
Next i


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2

Howard

Assign a sound to a variable
 
On Thursday, May 9, 2013 12:10:32 AM UTC-7, Claus Busch wrote:
Hi Howard,



Am Wed, 8 May 2013 23:39:17 -0700 (PDT) schrieb Howard:



Button START in on sheet named Main.




The Change Event code I posted here is NOT used in this case. I just posted it to sort of show that I wanted to play a sound (which I can choose from a drop down) and play it in the timer count down code I posted. Sorry, I sure did not make that clear.




To add, I can't find if this statement - SoundPlayAsyncOnce - will stop the code to play the sound or plays the sound while the code continues. There is another similar statement like this one and I cannot find where I read which was which. In the end, I prefer to keep code running and play sound.




try:

For i = 1 To 100 * Period

MyTime = MyTime - 0.01

SoundPlayAsyncOnce Sheets("Counter").Range("H1").Text

If (MyTime <= 0) Then Exit For

DoEvents

Next i





Regards

Claus Busch

--

Win XP PRof SP2 / Vista Ultimate SP2

Office 2003 SP2 /2007 Ultimate SP2


That did not work. Did you meant to omit the -Sleep 10- line?
Without it, the count down is very quick, I'm using 10 seconds in my test runs and w/o Sleep 10, it counts down in about 1 second. I added Sleep back in and runs normal, but no sound at all.

(note a typo in my previous post, sound string is actually in F1 of Main and Counter sheets, I changed it in my tests here)

And I tried both sheets F1's as you can see below Counter is commented out to see if it would work on Main. No go either sheet.

For i = 1 To 100 * Period
Sleep 10
MyTime = MyTime - 0.01
'SoundPlayAsyncOnce Sheets("Counter").Range("F1").Text
SoundPlayAsyncOnce Sheets("Main").Range("F1").Text
If (MyTime <= 0) Then Exit For
DoEvents
Next I

However, unless I'm going crazy, as I ponder what to try next or as I made the change to play on Main instead of Counter... the sound suddenly plays. Seems like it will play after the code has run, but waits for a few moments, perhaps as long as the 10 seconds I am using in the tests, then plays...????

Howard

Howard

Assign a sound to a variable
 



However, unless I'm going crazy, as I ponder what to try next or as I made the change to play on Main instead of Counter... the sound suddenly plays.. Seems like it will play after the code has run, but waits for a few moments, perhaps as long as the 10 seconds I am using in the tests, then plays....????



Howard


Regarding the "stray" sound playing, it plays AFTER the code has run and ONLY if I make a change to the code.

Not sure if that is useful info or not.

Howard

Claus Busch

Assign a sound to a variable
 
Hi Howard,

Am Thu, 9 May 2013 01:26:34 -0700 (PDT) schrieb Howard:

Regarding the "stray" sound playing, it plays AFTER the code has run and ONLY if I make a change to the code.


what values you have for WarningTime and Period?
Try in a standard module:

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

Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_LOOP = &H8
Const SND_PURGE = &H40

Public Sub SoundPlayAsyncLoop(Sound As String)
'SND_SYNC für synchrones Abspielen.
sndPlaySound Sound, SND_ASYNC Or SND_LOOP
End Sub
Public Sub SoundPlayAsyncOnce(Sound As String)
'SND_SYNC für synchrones Abspielen.
sndPlaySound Sound, SND_ASYNC
End Sub
Public Sub SoundStop()
sndPlaySound 0, SND_PURGE
End Sub

And in sheet "Main":

Sheets("Counter").Activate
While (.Value Period And Status)
SoundPlayAsyncLoop .Range("H1").Value
.Value = .Value - Period
MyTime = .Value
For i = 1 To 100 * Period
Sleep 10
MyTime = MyTime - 0.01
If (MyTime <= 0) Then
SoundStop
Exit For
End If
DoEvents
Next i
Wend
If (.Value <= Period) Then
SoundStop
.Value = "Time Up!"
End If


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2

Howard

Assign a sound to a variable
 

<what values you have for WarningTime and Period?
Warning time = 6 and Period = 0.2

Below is what I read your instruction to be, nothing else in either module or sheet vb editor.

This is what is in Main:

Option Explicit
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Public Status As Boolean


Private Sub cmdStart_Click()
Status = True
Dim i As Integer
Dim WarningTime As Integer
Dim Period As Double
Dim MyTime As Double

Sheets("Counter").Activate
While (.Value Period And Status)

SoundPlayAsyncLoop .Range("H1").Value

.Value = .Value - Period
MyTime = .Value


For i = 1 To 100 * Period
Sleep 10
MyTime = MyTime - 0.01


If (MyTime <= 0) Then

SoundStop
Exit For
End If

DoEvents
Next i
Wend
If (.Value <= Period) Then

SoundStop
.Value = "Time Up!"
End If
End Sub


This is what is in the standard module:

Option Explicit

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

Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_LOOP = &H8
Const SND_PURGE = &H40


Public Sub SoundPlayAsyncLoop(Sound As String)
'SND_SYNC f�r synchrones Abspielen.
sndPlaySound Sound, SND_ASYNC Or SND_LOOP
End Sub

Public Sub SoundPlayAsyncOnce(Sound As String)

'SND_SYNC f�r synchrones Abspielen.

sndPlaySound Sound, SND_ASYNC
End Sub

Public Sub SoundStop()
sndPlaySound 0, SND_PURGE
End Sub

When I click the start button get an error "Invalid or Unqualified Reference" and ".Value" in the line here is blue highlighted.

While (.Value Period And Status)

Claus Busch

Assign a sound to a variable
 
Hi Howard,

Am Thu, 9 May 2013 02:06:00 -0700 (PDT) schrieb Howard:

<what values you have for WarningTime and Period?
Warning time = 6 and Period = 0.2


it sounds not really good, but for me it works.

In the standard module:

Option Explicit
Private Declare Function sndPlaySound Lib "winmm.dll" _
Alias "sndPlaySoundA" (ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long

Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_LOOP = &H8
Const SND_PURGE = &H40

Public Sub SoundPlayAsyncLoop(Sound As String)
'SND_SYNC für synchrones Abspielen.
sndPlaySound Sound, SND_ASYNC Or SND_LOOP
End Sub
Public Sub SoundPlayAsyncOnce(Sound As String)
'SND_SYNC für synchrones Abspielen.
sndPlaySound Sound, SND_ASYNC
End Sub
Public Sub SoundStop()
sndPlaySound 0, SND_PURGE
End Sub

In code module of sheet "Main":

Option Explicit
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Public Status As Boolean

Private Sub cmdStart_Click()
Dim i As Integer
Dim WarningTime As Integer
Dim Period As Double
Dim MyTime As Double

Status = True
With Sheets("Main")
If .Cells(5, 1) = "" Then
WarningTime = .Cells(5, 4)
Else
WarningTime = .Cells(5, 1)
End If

If .Cells(8, 1) = "" Then
Period = .Cells(8, 4)
Else
Period = .Cells(8, 1)
End If
End With

If (Period < 0.01) Then Period = 0.01

With Sheets("Counter").Cells(2, 1)

.FormatConditions.Delete
.FormatConditions.Add xlCellValue, xlLessEqual, WarningTime

With .FormatConditions(1).Font
.Bold = True
.ColorIndex = 3
End With
.NumberFormat = Choose(Log(Period) / Log(10) + 3, "0.00", "0.0", "0")
.Value = Sheets("Main").Cells(2, 1).Value + Period

Sheets("Counter").Activate
While (.Value Period And Status)
SoundPlayAsyncLoop Sheets("Main").Range("F1").Text
.Value = .Value - Period
MyTime = .Value
For i = 1 To 100 * Period
Sleep 10
MyTime = MyTime - 0.01
If (MyTime <= 0) Then Exit For
DoEvents
Next i
Wend
If (.Value <= Period) Then
SoundStop
.Value = "Time Up!"
End If
End With
End Sub


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2

Claus Busch

Assign a sound to a variable
 
Hi Howard,

Am Thu, 9 May 2013 11:28:36 +0200 schrieb Claus Busch:

In code module of sheet "Main":


Status = True
With Sheets("Main")
If .Cells(5, 1) = "" Then
WarningTime = .Cells(5, 4)
Else
WarningTime = .Cells(5, 1)
End If


it sounds better when you start playing pressing the button:

With Sheets("Main")
SoundPlayAsyncLoop .Range("F1").Text
If .Cells(5, 1) = "" Then
WarningTime = .Cells(5, 4)
Else
WarningTime = .Cells(5, 1)
End If

The rest of the code stays unchanged


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2

Howard

Assign a sound to a variable
 
In code module of sheet "Main":



Status = True


With Sheets("Main")


If .Cells(5, 1) = "" Then


WarningTime = .Cells(5, 4)


Else


WarningTime = .Cells(5, 1)


End If




it sounds better when you start playing pressing the button:



With Sheets("Main")

SoundPlayAsyncLoop .Range("F1").Text

If .Cells(5, 1) = "" Then

WarningTime = .Cells(5, 4)

Else

WarningTime = .Cells(5, 1)

End If



The rest of the code stays unchanged


Still not working as I would like. And I am willing to accept the fact that it may not be sensible to keep flogging away at it.

Here is a drop box link to my workbook. I think it to be as you have instructed.

'https://www.dropbox.com/s/wih9sybw3zzqhb3/Sound%20Off%20A%20Few%20Sounds%20Drop%20Box.xlsm

There are notes to myself on Main sheet that me be of use to you, maybe not..

The main thing I was going after is to play a sound at the same time as the count down value in Counter sheet turns red.
Currently the sound plays only after count down value is 0 and "Time Up" appears.

The background pulsating sounds as the timer counts down needs to be eliminated, if possible. If not possible then probably no need to continue efforts with this project.

If it is normal NOT to be able to use the Main or Counter sheets for routine excel stuff, like entering values, or formulas, doing color formatting, cell formatting etc., then I am OK with that. HANDS OFF while count down is in progress is fine. Just need to know if that is the situation.

If the count down MUST stop to play the sound (again play sound at the designated count down value not at the end) and then resume after sound is played, that is also OK.

I appreciate you effort and time, but if it is time to pull the plug on this I have no problem. I fully respect your judgment as to whether to or not put any more energy into this.

Thanks.
Howard

Claus Busch

Assign a sound to a variable
 
Hi Howard,

The main thing I was going after is to play a sound at the same time as the count down value in Counter sheet turns red.
Currently the sound plays only after count down value is 0 and "Time Up" appears.

The background pulsating sounds as the timer counts down needs to be eliminated, if possible. If not possible then probably no need to continue efforts with this project.


if you want to play the sound if the value turns red, you have to put an
IF-Statement into the Loop and so you will have the pulsating sound

If it is normal NOT to be able to use the Main or Counter sheets for routine excel stuff, like entering values, or formulas, doing color formatting, cell formatting etc., then I am OK with that. HANDS OFF while count down is in progress is fine. Just need to know if that is the situation.

If the count down MUST stop to play the sound (again play sound at the designated count down value not at the end) and then resume after sound is played, that is also OK.


Load down your workbook "Sound of a few sounds" and/or "Howard_Sound"
from:
https://skydrive.live.com/#cid=9378A...121822A3%21191

In your workbook the sound starts now when time in A2 <= WarningTime but
it is pulsating. In Howard_Sound the sound plays all the time but it
sounds good.


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2

Howard

Assign a sound to a variable
 
On Thursday, May 9, 2013 4:49:30 AM UTC-7, Claus Busch wrote:
Hi Howard,



The main thing I was going after is to play a sound at the same time as the count down value in Counter sheet turns red.


Currently the sound plays only after count down value is 0 and "Time Up" appears.




The background pulsating sounds as the timer counts down needs to be eliminated, if possible. If not possible then probably no need to continue efforts with this project.




if you want to play the sound if the value turns red, you have to put an

IF-Statement into the Loop and so you will have the pulsating sound



If it is normal NOT to be able to use the Main or Counter sheets for routine excel stuff, like entering values, or formulas, doing color formatting, cell formatting etc., then I am OK with that. HANDS OFF while count down is in progress is fine. Just need to know if that is the situation.




If the count down MUST stop to play the sound (again play sound at the designated count down value not at the end) and then resume after sound is played, that is also OK.




Load down your workbook "Sound of a few sounds" and/or "Howard_Sound"

from:

https://skydrive.live.com/#cid=9378A...121822A3%21191



In your workbook the sound starts now when time in A2 <= WarningTime but

it is pulsating. In Howard_Sound the sound plays all the time but it

sounds good.





Regards

Claus Busch

--

Win XP PRof SP2 / Vista Ultimate SP2

Office 2003 SP2 /2007 Ultimate SP2



Hi Claus,

That is just perfect!
It never occurred to me to have the audio warning in sync with visual for the warning count down.

I'll have a look at the code change between my old and this revised winner.

You hit another one out of the ball park!

Thanks a lot.

Regards,
Howard

In your workbook the sound starts now when time in A2 <= WarningTime but

it is pulsating.



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com