Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default playing sounds from cell value

is it possible to play a sounds from cell value in excel??


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sounds simple but isn't - displaying cell text pieman3 Excel Worksheet Functions 5 April 5th 09 03:58 AM
Detecting the actual playing or NOT playing of a WAV file Bajbaj Excel Discussion (Misc queries) 0 October 24th 07 09:16 PM
Macros for playing sounds NAWBUS Excel Discussion (Misc queries) 3 December 15th 04 12:30 PM
Playing a sound base on cell value Mike[_58_] Excel Programming 4 November 30th 03 03:53 AM
Excel XP x Playing Sounds Paulo de Arruda Borelli Excel Programming 1 August 11th 03 07:51 PM


All times are GMT +1. The time now is 12:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"