
'in un modulo
Option Explicit
Public Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Sub avvia()
'Questo esempio esegue "sveglia" all'ora scritta in A1.
Application.OnTime TimeValue(CDate([a1])), "sveglia"
End Sub
Sub sveglia()
'suona un motivetto e visualizza la finestra di messaggio
sndPlaySound "c:windowsmedia ada.wav", True
MsgBox "Svegliaaa :)"
End Sub |
Sub sveglia()
'suona un motivetto e visualizza la finestra di messaggio
sndPlaySound "c:windowsmedia ada.wav", True
If [A2] = "" Then MsgBox "Svegliaaa :)" Else MsgBox [A2]
End Sub |
#If VBA7 Then
Private Declare Function sndPlaySound Lib "winmm.dll" Alias _
"sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As _
Long) As Long
Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_NODEFAULT = &H2
Const SND_LOOP = &H8
Const SND_NOSTOP = &H10
#Else
Public Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
#End If
Sub sveglia()
SoundName$ = "c:windowsmedia ada.wav"
wFlags% = SND_ASYNC Or SND_NODEFAULT
x% = sndPlaySound(SoundName$, wFlags%)
If [A2] = "" Then MsgBox "Svegliaaa :)" Else MsgBox [A2]
End Sub |
