![]() |
Button for wave file
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 |
Button for wave file
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 |
Button for wave file
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 |
Button for wave file
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 |
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 |
Button for wave file
Update!
Vasant. I used the code in the module and it works fine. Play the wave file perfectly. How do I get the command button to use the Macro? Yobeee "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 |
Button for wave file
Works Great!!! Thanks a million.
Yobeee "yo beee" wrote in message ... Update! Vasant. I used the code in the module and it works fine. Play the wave file perfectly. How do I get the command button to use the Macro? Yobeee "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 |
All times are GMT +1. The time now is 07:23 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com