For one, you are missing an & after "\" but that doesn't sound like the problem. Someone else knows more, but isn't the DLL file what contains the commands you can use? And it seems like you're trying to use the playsounda command in it? So maybe that command is being used incorrectly or is incorrectly named?
Its a typo just in here for the & after the "\".
This macro was mostly taken from Microsoft Excel 2000 Power Programming with VBA. I went through it several times looking for errors compaired to the book and it is exactly the same. If you remove the "a" from the "playsounda" it doesnt work at all (compile error)
anyone have any idea???
CANT FIND DLL ENTRY POINT PLAYSOUNDA IN WINMM.DLL
Juan Pablo, Mark W, anyone??
Sorry, not my cup of tea (nt)
Contrary to your Excel 2000 book...
Excel 2000 has had all the play record sounds functions deactivated by Microsoft. The only sounds you can make are the MSO sounds through the "Assistant" or tagging the "Beep" function. Sorry
Your book was probably a rewrite of a older version of Excel which you could play sounds. The sound section of the rewrite was not checked against Excel 2000 and the author did not expect Microsoft to remove such a basic function from the package. Excel 2000 help indicates that this function should not be used?
This is a poor substitute:
Sub myBeep()
'By Joe Was
'The higher the number the longer.
'Pulse is the attack of the waveform.
'Depth is the tone width of the wave form,
'a large width is a lower sound a small width is a higher sound.
'Freq is the tone vibrato (resonance).
'All perimeters are based upon the speed of the computer.
'The fundamental sound is based upon the basic beep function.
'So the range is limited to the fundamental permutations into
'the sharp and flat range of the basic beep with some affects.
'Below diagrams one complete wave form:
'attack - start - brightness, tonal - element, finish.
'Attack 1/4, Attack 2nd 1/4 finish, 3rd 1/4 decay and last 1/4 decay finish.
'It helps to graph your wave form out and to use a tonal scale.
myPulse 320
myDepth 120
myFreq 80
myPulse 20
myDepth 1640
myFreq 160
myPulse 40
myDepth 1320
myFreq 40
myPulse 50
myDepth 140
myFreq 32
End Sub
Sub myPulse(numtones)
For counter = 1 To numtones
Beep
Next counter
End Sub
Sub myFreq(numbeeps)
For counter = 1 To numbeeps
Beep
Next counter
End Sub
Sub myDepth(numbeats)
For F = 1 To numbeats
Next F
For A = 1 To numbeats
Next A
For C = 1 To numbeats
Next C
For E = 1 To numbeats
Next E
End Sub
JSW.
Re: Juan Pablo, Mark W, anyone??
Try this instead;
Declare Function PlaySound Lib "winmm.dll" Alias "sndPlaySoundA" _
(ByVal lpszName As String, ByVal dwFlags As Long) As Long
Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000
Sub PLAYWAV()
Dim wavefile, x
If Worksheets("514").Range("F53") < "31" Then
wavefile = "5VOLT.WAV"
wavefile = ThisWorkbook.Path & "\" & wavefile
Call PlaySound(wavefile, SND_ASYNC Or SND_FILENAME)
End If
End Sub
Ivan
Thank you Ivan, works like a champ....thanks again
Declare Function PlaySound Lib "winmm.dll" Alias "sndPlaySoundA" _
Thanks, Ivan:
I never thought of re-addressing "Winmm.dll" to get around Excel 2000's sound problem good going, I like it.
Excel XP has the sound back in and it has "text to Speach."
One problem with the text to speach is it does the whole sheet, I have not been able to to play a cell or range? Joe Was