How to program Excel 2010 Win7 64bit to play audio waves in response to changing variables

phinsdale

New Member
Joined
Apr 28, 2014
Messages
5
Operating environment: Windows 7 64 bit running Excel 2010.

My present application processes streaming data and generates constantly changing visual interpretations. Now I want to make the application talk to me in English.

My plan: 1. Record a variety of alert messages and action commands as WAV files. 2. Create a new spreadsheet with a separate range related to each contemplated wav message. 3. Test the values in the ranges against a standard. 4. If a hit, use VBA to play the recorded message. It needs to be very fast to keep up with the streaming data.

Problem: I thought I knew how to write the desired program, but apparently Win 7 64bit has disabled the old VBA commands.

I have Mr. Jelen's book VBA and Macros on my Kindle. From that I decided to join this forum.

I know that this subject was addressed when Win 7 64bit was new. My application is not commercial and it does not need to be backward compatible. Thank in advance for the boost that will put me over the hurdle. Palmer Hinsdale
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Are you using 64bit Office as well as 64bit Windows?

What VBA commands are you having an issue with exactly?
 
Upvote 0
Are you using 64bit Office as well as 64bit Windows?

What VBA commands are you having an issue with exactly?


Rory, Thank you for your response.
Yes I am using 64bit Office.
I was trying to use Play Sound which I had learned some years ago.
I think my problem is that really do not understand the API environment as distinct from Excel and VBA.
Thanks, Palmer.
 
Upvote 0
Can you post the code you were using? You often just need to change the API declarations to use Declare PtrSafe rather than just Declare, unless the code uses window handles.
 
Upvote 0
Rory--I have done some additional work, but I am still failing.

Changed info: my system is running Excel 2010 (32 bit) Office 2010 (32 bit) under Windows 7 with a 64 bit processor.

Here is the code which fails. Obtained from Mr. Jelen's book "VBA and Macros"

Option Explicit
Option Base 1


Public Declare Function PlayWavSound _
Lib "winmm.dll" _
Alias "sndPlaySoundA" _
(ByVal LpszSoundName As String, _
ByVal uFlags As Long) As Long


Public Sub Playsound()
Dim SoundName As String


SoundName = "C:Windows\Media\Tada.wav"
PlayWavSound SoundName, 0

End Sub

BTW, I want the sound to be played with ASYNC so that it does not stop the flow of my primary program. The snippet above is just a test on my laptop.

Thanks. Palmer
 
Upvote 0
You appear to be missing a backslash here:
Rich (BB code):
SoundName = "C:\Windows\Media\Tada.wav"
 
Upvote 0
Thank that fixed it with sounds which are part of Windows. Not working with my recorded voice. Now I realize that Microsoft changed the file type for recording to WMA. So, I guess my next step is to learn how to record WAV. Thanks. Palmer.
 
Upvote 0

Forum statistics

Threads
1,214,976
Messages
6,122,539
Members
449,088
Latest member
RandomExceller01

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