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 music

Is there a way to write a code in an excel file that will enable me to
play some music (on windows media player etc) and after the piece is
played, return me back to excel?

Thanks,

Naveen
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Playing music

Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" _
(ByVal lpszName As String, _
hModule As Long, _
ByVal dwFlags As Long) As Long

'-----------------------------------------------------------------
Public Function PlayWavFile(WavFile As String) As String
'-----------------------------------------------------------------
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000
PlaySound WavFile, 0, SND_ASYNC Or SND_FILENAME
PlayWavFile = ""
End Function


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Naveen Sukhramani" wrote in message
om...
Is there a way to write a code in an excel file that will enable me to
play some music (on windows media player etc) and after the piece is
played, return me back to excel?

Thanks,

Naveen



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Playing music

Here is one I use in a double_click event to play the highlighted title
where the full file name is in col E and I am clicking any column. Also,
look at the other one

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Target.Row = 4 Then
Range("a5:g" & Range("a65536").End(xlUp).Row) _
..Sort Key1:=Cells(5, ActiveCell.Column), Order1:=xlAscending,
Orientation:=xlTopToBottom
Cells(5, Target.Column).Select
End If
mc = Cells(ActiveCell.Row, "e")
If Target.Row 4 Then
x = Right(Application.OperatingSystem, 4)
If x < 5 Then
cmd = "Start " & Chr(34) & mc & Chr(34)
Shell cmd 'works with xl97
Else
Dim FullFileName As String
FullFileName = mc
ActiveWorkbook.FollowHyperlink Address:=FullFileName
End If
End If
End Sub
======
This might be easier for you.

Sub playselections()
For Each C In Selection
mc = Cells(C.Row, "e")
x = Right(Application.OperatingSystem, 4)
If x < 5 Then
cmd = "Start " & Chr(34) & mc & Chr(34)
Shell cmd 'works with xl97
Else
Dim FullFileName As String
FullFileName = mc
ActiveWorkbook.FollowHyperlink Address:=FullFileName
End If
Next
End Sub


--
Don Guillett
SalesAid Software

"Naveen Sukhramani" wrote in message
om...
Is there a way to write a code in an excel file that will enable me to
play some music (on windows media player etc) and after the piece is
played, return me back to excel?

Thanks,

Naveen



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
Detecting the actual playing or NOT playing of a WAV file Bajbaj Excel Discussion (Misc queries) 0 October 24th 07 09:16 PM
Games not playing in Excel [email protected] Excel Discussion (Misc queries) 0 January 29th 07 10:32 PM
music music icons New Users to Excel 5 October 30th 05 11:35 PM
Playing a .wav when a cell's value changes Jimm L Excel Programming 3 January 29th 04 04:10 PM
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 10:53 AM.

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

About Us

"It's about Microsoft Excel"