Play a certain sound on command

brianjessup

Registered User.
Local time
Today, 04:47
Joined
May 25, 2003
Messages
36
How would you play your own sound bites when you want?
 
I am not sure about that one, but I'll give it a try, since no one else gave you answers.

I think it is :
Call Shell(«Your sound file»)
 
Try this...
Code:
Option Compare Database
Option Explicit
  
'PlayWaveFile
Declare Function apisndPlaySound Lib "winmm" Alias "sndPlaySoundA" (ByVal filename As String, ByVal snd_async As Long) As Long
    
Public Function PlayWaveFile(sWavFile As String)
    
    If apisndPlaySound(sWavFile, 1) = 0 Then
        'MsgBox "The Sound Did Not Play!"
    End If
    
End Function
    
Public Sub PlayWaveFile_Cord()
    
    Call PlayWaveFile("C:\Windows\Media\chord.wav")
    
End Sub
HTH
 
Thanks!

Newman, I didn't try your suggestion yet, but ghudson, I did and wow that's awesome!!! Works like a charm. Thanks so much to both of you!
 
Hey Ghudson,

how do you call that code through a button?
 
hmongie said:
Hey Ghudson,
how do you call that code through a button?

Your kidding, right?
Code:
Private Sub YourCommandButton_Click()
Call PlayWaveFile_Cord
End Sub
 
ghudson said:
Your kidding, right?
Code:
Private Sub YourCommandButton_Click()
Call PlayWaveFile_Cord
End Sub


nah... no kidding...

I tried it but it wouldn't play. When I do run the module, it runs fine. On a command button, it's not referencing the module at all. I tried the above already. I'll try it again.
 

Users who are viewing this thread

Back
Top Bottom