MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old May 1st, 2002, 02:07 AM   #1
Tom Schreiner
Board Regular
 
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
Default

Thanks guys...
Tom
Tom Schreiner is offline   Reply With Quote
Old May 1st, 2002, 02:21 AM   #2
Jackeb
Board Regular
 
Join Date: Mar 2002
Posts: 81
Default

Using VB MIcrosofr has a MCI control (Media control interface)

this control connects to most spound sources.... guess you could use its properties to play a sound??

Ed
Jackeb is offline   Reply With Quote
Old May 1st, 2002, 02:31 AM   #3
Ivan F Moala
MrExcel MVP
 
Ivan F Moala's Avatar
 
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
Default

Hi Tom
You can Play virtually anything you like
and in a number of ways.
What excatly do you want to do ??

If you like I can send you example files
to Play a Wave,Midi,MP3,AVI files located
either on your drive or embeded in an excel
File.....
__________________
Kind Regards,
Ivan F Moala From the City of Sails
Ivan F Moala is offline   Reply With Quote
Old May 1st, 2002, 02:40 AM   #4
Tom Schreiner
Board Regular
 
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
Default

Thanks for the replies...
I created a spreadsheet for my daughter to practice her multiplication.
It is set up like a game with command buttons and a timer.
I'd like to add sounds for various events.

Wrong Answer
Right Answer
High Score
Timer Clicks
Ect...

I could find nothing in help...

Thanks again!
Tom

P.S.
Thanks Ivan for the offer...
I'd love to have the example files...
If you have any kids, I'll send you the spreadsheet when I'm done...

Tom

[ This Message was edited by: TsTom on 2002-05-01 01:41 ]
Tom Schreiner is offline   Reply With Quote
Old May 1st, 2002, 03:08 AM   #5
Ivan F Moala
MrExcel MVP
 
Ivan F Moala's Avatar
 
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
Default

Hi Tom
Just to get you started.
Why not record what you want eg...WRONG ANSWER, RIGHT ON etc....probably sound
better coming from Mum
Then just use this code to play the wave files you have recorded.


Option Explicit

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

Public Const SND_SYNC = &H0
Public Const SND_ASYNC = &H1
Public Const SND_NODEFAULT = &H2
Public Const SND_MEMORY = &H4
Public Const SND_LOOP = &H8
Public Const SND_NOSTOP = &H10

Dim SndFile As String
Dim wFlags As Double
Dim PlayIt

Sub WAVPlay(File)
Dim SoundName As String

SoundName = File

wFlags = SND_ASYNC Or SND_NODEFAULT

PlayIt = sndPlaySound(SoundName, wFlags)

End Sub

Sub Wrong()
SndFile = "C:MEDIAwrong.wav"

If Dir(SndFile) = "" Then MsgBox "Sorry no File to Play!": End

PlayIt = sndPlaySound(SndFile, SND_ASYNC)

End Sub




Tom....I have Kids would appreciate a copy


__________________
Kind Regards,
Ivan F Moala From the City of Sails
Ivan F Moala is offline   Reply With Quote
Old May 1st, 2002, 03:32 AM   #6
Tom Schreiner
Board Regular
 
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
Default

What you have right there is great, Ivan...
Would like to know how to play midi files as well.
Thanks!
Tom Schreiner is offline   Reply With Quote
Old May 1st, 2002, 03:41 AM   #7
Ivan F Moala
MrExcel MVP
 
Ivan F Moala's Avatar
 
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
Default

Quote:
On 2002-05-01 02:32, TsTom wrote:
What you have right there is great, Ivan...
Would like to know how to play midi files as well.
Thanks!

Option Explicit


Declare Function mciSendString Lib "winmm" Alias "mciSendStringA" _
(ByVal lpstrCommand As String, ByVal lpstrReturnString As Any, _
ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
'// Function Discription:
'// The mciSendString function sends a command string to an MCI device.
'// The device that the command is sent to is specified in the command string.
'//
'// Success:
'// Returns zero if successful or an error.
'// The low-order word of the returned doubleword value contains the error return value.
'// If the error is device-specific, the high-order word of the return value is the
'// driver identifier; otherwise, the high-order word is zero.
'//
'// Parametre discriptions:
'// -lpszCommand
'// Address of a null-terminated string that specifies an MCI command string.
'// For more information about the command strings, see Command Strings.
'//
'// -lpszReturnString
'// Address of a buffer that receives return information.
'// If no return information is needed, this parameter can be NULL.
'//
'// -cchReturn
'// Size, in characters, of the return buffer specified by the lpszReturnString parameter.
'//
'// -hwndCallback
'// Handle of a callback window if the "notify" flag was specified in the command string.


Const sMidiFile As String = "C:WINDOWSMEDIAimposs[1].mid "

Dim Play

Sub Play_Midi()
'// Discription:
'// Plays a Midi sound File
'// Specified by Const sMidiFile
'//

Play = mciSendString("play " & sMidiFile, 0&, 0, 0)
If Play <> 0 Then MsgBox "Can't PLAY!"

End Sub

Sub Stop_Midi()
Play = mciSendString("close " & sMidiFile, 0&, 0, 0)
End Sub






__________________
Kind Regards,
Ivan F Moala From the City of Sails
Ivan F Moala is offline   Reply With Quote
Old May 1st, 2002, 04:24 AM   #8
Tom Schreiner
Board Regular
 
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
Default

Thanks alot guys and Ivan especially, as usual.
Tom
Tom Schreiner is offline   Reply With Quote
Old May 1st, 2002, 12:21 PM   #9
EdE
Board Regular
 
Join Date: Apr 2002
Location: A Mile High!!
Posts: 230
Default

Hi Tom --

I would like a copy too if that is okay when youre done. My kid will do these things as long as they are "cool."

thanks!!
EdE is offline   Reply With Quote
Old May 2nd, 2002, 06:22 AM   #10
Dsuperc
Board Regular
 
Join Date: Apr 2002
Posts: 134
Default

I would like a copy when its done, Thanks
Dsuperc@hotmail.com
Dsuperc is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 01:52 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes