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
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = 0 Then PlayPanPanCuCu
End Sub
Et dans un module standard
Code:
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
Non bien sur moi non plus, j'ai remplacer ce qu'il falait.
Mais finalement avec : Private Sub UserForm_Terminate()
ça fonctionne très bien.
Merci quand même de m'avoir répondu.
Cordialement
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
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
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