' Sección general de declaraciones
Dim HorInicio As Date
Dim HorFinal As Date
Dim Sonar As Boolean
Dim hora As Date
Private Sub Command2_Click() 'Detener
Sonar = False
End Sub
Private Sub Command1_Click() 'Aceptar
'
' Los datos introducidos en Text1 y Text2
' deben tener el formato hh:mm:ss
HorInicio = CDate(Text1.Text)
'
HorFinal = CDate(Text2.Text)
'
Sonar = True
'
End Sub
Private Sub Form_Load()
Timer1.Interval = 2000 'Por lo general se usa 500
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Label1.Caption = Str(Time)
'
hora = CDate(Format(Time, "hh:mm:ss")) ' Para eliminar la partícula a.m/p.m
'
If (Sonar = True) Then
If (hora >= HorInicio And hora <= HorFinal) Then
Beep
'Print "Hola"
End If
End If
End Sub