Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
playing sounds from cell value
is it possible to play a sounds from cell value in excel??
|
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
playing sounds from cell value
also can you stop a sound from playing with a cell value
"sl" wrote in message ... is it possible to play a sounds from cell value in excel?? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
playing sounds from cell value
Not sure how you play or stop a sound with a cell value ... you need some
event to occur to trigger a macro. -- Vasant "sl" wrote in message ... also can you stop a sound from playing with a cell value "sl" wrote in message ... is it possible to play a sounds from cell value in excel?? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
playing sounds from cell value
Hi SL,
This is the code I use to play a sound file in excel, as long as the soundfile is in the same workbook folder it will play it, just change 'yourwavfile' to whatever sound file you want to play... Private Declare Function PlaySound Lib "winmm.dll" _ Alias "PlaySoundA" (ByVal lpszName As String, _ ByVal hModule As Long, ByVal dwFlags As Long) As Long Const SND_SYNC = &H0 Const SND_ASYNC = &H1 Const SND_FILENAME = &H20000 Sub RunSLmacro() WAVFile = "yourwavfile.wav" WAVFile = ThisWorkbook.Path & "\" & WAVFile Call PlaySound(WAVFile, 0&, SND_ASYNC Or SND_FILENAME) End Sub As for playing it when a cell value changes you could do something like: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$A$1" Then ' change you cell here RunSLmacro End If End Sub hope this helps... seeya ste |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
playing sounds from cell value
that was a great help
thanks very much.. "ste mac" wrote in message om... Hi SL, This is the code I use to play a sound file in excel, as long as the soundfile is in the same workbook folder it will play it, just change 'yourwavfile' to whatever sound file you want to play... Private Declare Function PlaySound Lib "winmm.dll" _ Alias "PlaySoundA" (ByVal lpszName As String, _ ByVal hModule As Long, ByVal dwFlags As Long) As Long Const SND_SYNC = &H0 Const SND_ASYNC = &H1 Const SND_FILENAME = &H20000 Sub RunSLmacro() WAVFile = "yourwavfile.wav" WAVFile = ThisWorkbook.Path & "\" & WAVFile Call PlaySound(WAVFile, 0&, SND_ASYNC Or SND_FILENAME) End Sub As for playing it when a cell value changes you could do something like: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$A$1" Then ' change you cell here RunSLmacro End If End Sub hope this helps... seeya ste |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Sounds simple but isn't - displaying cell text | Excel Worksheet Functions | |||
Detecting the actual playing or NOT playing of a WAV file | Excel Discussion (Misc queries) | |||
Macros for playing sounds | Excel Discussion (Misc queries) | |||
Playing a sound base on cell value | Excel Programming | |||
Excel XP x Playing Sounds | Excel Programming |