Button for wave file
Hi Yobeee:
Sorry, I should have been clearer.
In a standard module:
Declare Function PlaySound Lib "winmm.dll" _
Alias "PlaySoundA" (ByVal lpszName As String, _
ByVal hModule As Long, _
ByVal dwFlags As Long) As Long
Public Sub PlayMe()
Dim retval As Long
retval = Module1.PlaySound("C:\user\Book\chord.wav", 0, &H20000)
End Sub
In the CommandButton code:
Private Sub CommandButton1_Click()
PlayMe
End Sub
Regards,
Vasant.
"yo beee" wrote in message
...
Hi Vasant,
I put the code into the button and when I clicked it, I received a
Microsoft Visual Basic error stating the following:
"Compile Error:
Constants, fixed-length strings, arrays, user-defined types and Declare
statements not allowed as Public members of object modules"
Any suggestions? Did I do something wrong?
Thanks for all the help...
Yobeee
"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message
...
Hi Yobeee:
It should go in the code of the CommandButton.
Regards,
Vasant.
"yo beee" wrote in message
...
Thanks Vasant,
Where does the stament go? Into the code of the command button,
a
module? Please let me know and thanks for the help.
Yobeee
"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message
...
Hi:
Declare Function PlaySound Lib "winmm.dll" _
Alias "PlaySoundA" (ByVal lpszName As String, _
ByVal hModule As Long, _
ByVal dwFlags As Long) As Long
Sub PlayMe()
Dim retval As Long
retval = PlaySound("C:\user\Book\chord.wav", 0, &H20000)
End Sub
Regards,
Vasant.
"yo beee" wrote in message
...
Hey all,
Thanks to all programmers who help us newbies out all the
time.
You
are
invaluable. I'm sure this issue has been here before but here
goes.
I need a command button to play a wave file. My wave file is
called
"chord.wav" and resides in the following directory: "C:\user\Book"
My
Excel
workbook resides in the same directory and is called "MNB.xls" The
user
hits
the button and the wave file plays. That's it.
TIA
|