Sub Alert()
Dim spath As String, cmd As String
spath = "C:\Users\Administrator\Desktop\超過100.wav"
cmd = "sndrec32 /play /close " & Chr(34) & spath & Chr(34)
Shell cmd, 6
End Sub
Sub Alert2()
Dim spath As String, cmd As String
spath = "C:\Users\Administrator\Desktop\小於100.wav"
cmd = "sndrec32 /play /close " & Chr(34) & spath & Chr(34)
Shell cmd, 6
End Sub
Sub 每隔若干秒執行()
IF Time < TimeValue("08:45:00") And Time > TimeValue("13:45:00") Then Exit Sub
With Activesheet
For Each x In .Range("A1",.Range("A1").end(xlDown))
If x > 100 Then Application.Run "Alert"
If x < 100 Then Application.Run "Alert2"
Next
End With
t = DateAdd("s",每隔若干秒,Time)
Application.OnTime t, "每隔若干秒執行"
End Sub作者: luhpro 時間: 2014-12-6 01:25