Can you get a wave file to play a variable?

rpwagner

New Member
Joined
Feb 28, 2002
Messages
22
Assume I have cell a1 that has a value in it. And, this value is increasing. If it hits (for example), 50, can I have a vb fire off a wav file that says something like "value is 50". and then, if the value in a1 goes up again (say to 75), it says "value is 75" and so forth for all the triggure values I want to code for.
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Hi rpwagner,

Yes, this is easy to do, assuming that you have a .wav file for every level you want flagged (I assume you've recorded your own voice here--although for a few thousand bucks you could probably get James Earl Jones or Brittney Spears to do it). Simply put code into the worksheet's Calculate event that checks the value against each of the levels, and plays the appropriate file.

If you want an example, let me know the levels and .wav file names you intend to use.

Keep Excelling.

Damon
 
Upvote 0
Thanks for responding. Below, is an excerpt for the code (that works). If Qtr1Percent is > .35, the specific wave file will fire off and play. However, the wave files just says "it is greate than 35 percent when in actuality, it may be 45 percent. I would like the wave file to play whaterver the value of Qtr1Percent actually is (ie. 45 percent). That way, I know realtime exactly how high it is. I do not want to have to code a whole bunch of wave files for all the possible values Qtr1Percent could be. Is this possible (to use a variable in the wave file? Thanks in advance.

If WhatTime = 15 And .Range("Qtr1Percent").Value > 0.35 Then
Call PlayWavFile _
("C:\Documents and Settings\Robert P Wagner\My Documents\15VolAlert.wav")
End If
 
Upvote 0
Hi again rpwagner,

Unfortunately, it is not possible to have a wave file "play a number". You would have to have a different wave file for each number. This is because wave files are just digitized amplitude vs. time data. If you have a voice synthesizer card in your computer such as used by blind people, you could do this--except it wouldn't be a wave file. You would then be passing a string to the voice synthesizer card using the card's software interface (probably a DLL like the one your wave file Play routine uses).

Regarding the wave file issue, instead of recording 101 wave files (for zero to 100 percent) you could have wave files for the numbers "one" through "nineteen" and also "twenty", "thirty", "forty", etc., and play these in sequence to get all 101 numbers using only about 30 wave files. For example, to get the number 54%, you would play the wave file "fifty" followed by "four" followed by "percent".
 
Upvote 0
Thanks Juan.... I typed speech into the help for both Excel and vba and nothing comes up. Additionally, there is no addin for that (at least from what I can see). Finally, I could not find anything on this forum. Any Suggestions
 
Upvote 0

Forum statistics

Threads
1,214,590
Messages
6,120,421
Members
448,961
Latest member
nzskater

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