Need help playing embedded wav/mp3 when condition is met

1nk3d

Board Regular
Joined
May 31, 2016
Messages
51
I need help with this spreadsheet. We cannot load the sound files on computers, so the files need to be embedded. They can be a wav or an mp3. The spreadshet is used to track projected hours for each store. Ideally we would like a cash register sound (green.wav) to play when the value is greater than 0, however the number is always greater than 0 as it counts down the hours, so unless there is a way to hide the value until all cells are completed?

What would probably be easier is to play a whammy sound of sort when the value is negative. I have it working, however it only works when my thumb drive is in the computer as th sound file is located there. So I need a file to point to the location of it on an embedded shet, maybe we can hide it?

I can't run any sort of script to temporarily put the file somewhere, as these are government computers....

Code:
Private Declare Function PlaySound Lib "winmm.dll" _
Alias "PlaySoundA" (ByVal lpszName As String, _
ByVal hModule As Long, ByVal dwFlags As Long) As Long

Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000


Private Sub Worksheet_Calculate()
Const FName As String = "bad.wav"
If Range("I2").Value > 22.2 Then
Call PlaySound(FName, 0&, SND_ASYNC Or SND_FILENAME)
End If
End Sub

<tbody>
</tbody>
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Can't figure out how to edit, but in the above code, it lists 22.2 as the value, it should be less than 0. Sorry
 
Upvote 0
Perhaps we can use, is it vytes? to move file temporarily to desktop, however, each user has a different log on id... Also would it be possible just to hyperlink the file?
 
Upvote 0

Forum statistics

Threads
1,215,520
Messages
6,125,301
Members
449,218
Latest member
Excel Master

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top