LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default No sound with display

The Public declare function for the mciExecute is at the top of the module as
is the other Public declare function which I use for .wav files. The sub
that turns the midi file on and off is titled PlayMidiFile. The last sub is
the one that calls the PlayMidiFile during normal code execution. I have
stepped through the code and it is finding the midi file and is telling it to
execute. The problem is that there is no sound. I have to assume that it
does not execute. There have been several automatic downloads to my system
lately and I have no idea what they might have affected, but this code was
working perfectly until I tried it today. I can play the midi file using the
Windows Media Player, so the midi file is not corrupt.

Does anybody have a clue? It has me snowed.



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

Public Declare Function mciExecute Lib "winmm.dll" _
(ByVal lpstrCommand As String) As Long

Sub PlayMidiFile(MidiFileName As String, Play As Boolean) 'Function for
calling midi files
If Dir(MidiFileName) = "" Then Exit Sub ' no file to play
If Play Then
mciExecute "play " & MidiFileName ' start playing
Else
mciExecute "stop " & MidiFileName ' stop playing
End If
End Sub

Sub x()
MidiStr = ""
On Error Resume Next
MidiStr = Dir("c:\windows\media\*.mid")
On Error GoTo 0
If MidiStr < "" Then
Set fs = Application.FileSearch
With fs
.LookIn = "C:\Windows\Media"
.Filename = "*.mid"
If .Execute 0 Then
MySnd = .FoundFiles(1)
End If
End With
PlayMidiFile (MySnd), True
End If
End Sub


 
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
Sound with excel bau Excel Discussion (Misc queries) 0 March 9th 08 11:21 PM
Sound on Excel girgor Excel Discussion (Misc queries) 5 March 3rd 08 05:49 PM
Display Text and Play Sound file Soniya[_4_] Excel Programming 0 February 27th 06 06:17 AM
Display Text and Play Sound file Soniya[_4_] Excel Programming 0 February 26th 06 06:39 AM
playing sound??? tess457[_6_] Excel Programming 2 October 20th 04 11:50 AM


All times are GMT +1. The time now is 02: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"