Option Explicit
Declare Function sndPlaySound32 Lib "winmm.dll" _
Alias "sndPlaySoundA" (ByVal lpszSoundName _
As String, ByVal uFlags As Long) As Long
Private Sub UserForm_QueryClose _
(Cancel As Integer, CloseMode As Integer)
Call sndPlaySound32("C:\WINNT\Media\ringin.wav", 1)
End Sub
Private Sub UserForm_Terminate()
Application.Speech.Speak "Thanks you"
Application.Speech.Speak "Bye"
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = 0 Then PlayPanPanCuCu
End Sub
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, _
ByVal hModule As Long, ByVal dwFlags As Long) As Long
Sub PlayPanPanCuCu()
[COLOR="Red"]PlaySound "C:\...\ ...\PanPanCuCu.wav", &O0, 0[/COLOR]
End Sub
Est-il possible de mettre un "son.wav" quand on quitte le Formulaire avec la "croix" ?
PS : pas avec un bouton.
Private Sub UserForm_Terminate()
Ma macro
End Sub
Private Sub UserForm_Terminate()
Application.Speech.Speak "Pan pan cu cu "
End Sub
Re,
Je te signale quand même que je n'ai aucun fichier nommé PanPanCuCu sur mon disque non plus...sait-on jamais
A+
kjin
Bonjour,
Il te faut sans doute combiner la fonction sndPlaySound32
et la fermeture de la UserForm ...
A tester ...
Code:Option Explicit Declare Function sndPlaySound32 Lib "winmm.dll" _ Alias "sndPlaySoundA" (ByVal lpszSoundName _ As String, ByVal uFlags As Long) As Long Private Sub UserForm_QueryClose _ (Cancel As Integer, CloseMode As Integer) Call sndPlaySound32("C:\WINNT\Media\ringin.wav", 1) End Sub
A +
bonjour à tous,
Guy ,
le code de James marche....il y'a juste une erreur dans le code de l'usf
il faut remplacer Call sndPlaySound32("C:\WINNT\Media\ringin.wav", 1)
par celui-ci :
Call sndPlaySound32("C:\WINDOWS\Media\ringin.wav", 1)
a mettre dans un module:
Declare Function sndPlaySound32 Lib "winmm.dll" _
Alias "sndPlaySoundA" (ByVal lpszSoundName _
As String, ByVal uFlags As Long) As Long
voilou...
bonne journée
limat