Dim begin = TickCount() //获取开始时间 do TracePrint "搞事中..." Delay 800 if IsEnd(begin,1) then//1分钟后超时 exit do End If Loop //----------------------------------------------- Function IsEnd(startTime,endTime) //超时函数封装 if ((TickCount()-startTime)/1000/60)>endTime then //1000为一秒 60为一分钟 IsEnd = True TracePrint "超时..." Exit Function Else IsEnd = False Exit Function End if End Function