Playing A Sound File (.wav / .mid)

rapsr59

Registered User.
Local time
Today, 16:28
Joined
Dec 5, 2007
Messages
93
HI EVERYBODY!

I'm programming an audible cash register that will play sound files when the purchase is completed. EXAM: "Your Total Is Four Dollars And Thirty-Six Cents". I've completed the algorithm for computing which sound files will play; calling each sound file as needed for playback.


I am in need of VBA code that will allow me to play a specific .wav sound file as needed.
EXAM:

This I programmed. (The algorithm is not as simple as shown below but I decided, for brevity sake, to describe it accordingly.)

---------------------------------------------------------
Public Sub PlayYourTotal()
Call Play (YourTotalIs.wav)
Call Play (Four.wav)
Call Play (Dollars.wav)
Call Play (And.wav)
Call Play (Thirty.wav)
Call Play (Six.wav)
Call Play (Cents.wav)
End Sub

Public Function Play(WavName)
'Play the .wav file
(What code goes here?)
End Function

----------------------------------------------------------

At this time I don't know how to play a .wav file. I'm sure that if I can play one sound file (.wav), I can play them all.


Thank you for your consideration and most appreciated help.



Richard
 
here's a link you may find useful

http://www.allenbrowne.com/func-04.html

Essentially you would need to modfy the function to add the rest of the path if the files are all stored in the correct place, or else pass the full path to the file each time.

You also need to pass the filename as a string, eg.,
Call Play ("Cents.wav")
not
Call Play (Cents.wav)
 
Play a Sound Wave

Dear Mr. Craig Dolphin

Already tried your answer.


It worked PEFECTLY!

Thank a million and a half.


Richard:cool:
 
Glad to help. :) (although the credit belongs to Allen Browne)
 

Users who are viewing this thread

Back
Top Bottom