|
ThisWorkbook里已经有这些代码:
模块1里有如下代码:
- Dim RunWhen
- Sub run_Timer()
- RunWhen = Now + TimeValue("00:01:00")
- Application.OnTime RunWhen, "chktime", Schedule:=True
- End Sub
- Sub shut_Timer()
- Application.OnTime RunWhen, "chktime", Schedule:=False
- End Sub
- Sub chktime()
- Application.ScreenUpdating = False
- '启动大批镜片1
- '-------------------------------------------------------------------------------------------------------------
- If Format(Time, "h:mm") = "6:50" Or Format(Time, "h:mm") = "9:50" Or Format(Time, "h:mm") = "10:50" Or _
- Format(Time, "h:mm") = "13:50" Or Format(Time, "h:mm") = "17:50" Or Format(Time, "h:mm") = "19:50" Then '自动启动时间
- Call comb_Sunglass1
- End If
- '-------------------------------------------------------------------------------------------------------------
- '启动大批镜片2
- '-------------------------------------------------------------------------------------------------------------
- If Format(Time, "h:mm") = "5:50" Or Format(Time, "h:mm") = "7:50" Or Format(Time, "h:mm") = "8:50" Or Format(Time, "h:mm") = "12:50" _
- Or Format(Time, "h:mm") = "14:50" Or Format(Time, "h:mm") = "15:50" Or Format(Time, "h:mm") = "18:50" Or Format(Time, "h:mm") = "20:30" Then '自动启动时间
- Call comb_Sunglass2
- End If
- '-------------------------------------------------------------------------------------------------------------
- '启动额外打标签
- '-------------------------------------------------------------------------------------------------------------
- If Format(Time, "h:mm") = "5:45" Then '自动启动时间
- Call comb_EXPICK
- End If
- '-------------------------------------------------------------------------------------------------------------
- '启动额外打标签
- '-------------------------------------------------------------------------------------------------------------
- If Format(Time, "h:mm") = "6:20" Or Format(Time, "h:mm") = "21:10" Then '自动启动时间
- Call comb_EXPICK
- End If
- '-------------------------------------------------------------------------------------------------------------
- '启动有色腿镜片
- '-------------------------------------------------------------------------------------------------------------
- If Format(Time, "h:mm") = "12:20" Then '自动启动时间
- Call comb_Sunglass_0R
- End If
- '-------------------------------------------------------------------------------------------------------------
- '启动RX镜片
- '-------------------------------------------------------------------------------------------------------------
- If Format(Time, "h:mm") = "16:50" Then '自动启动时间
- Call comb_SunglassRX
- End If
- '-------------------------------------------------------------------------------------------------------------
- '启动TRD AN
- '-------------------------------------------------------------------------------------------------------------
- If Format(Time, "h:mm") = "8:10" Then '自动启动时间
- Call comb_TRDAN
- End If
- '-------------------------------------------------------------------------------------------------------------
- '启动TRC AN
- '-------------------------------------------------------------------------------------------------------------
- If Format(Time, "h:mm") = "10:10" Then '自动启动时间
- Call comb_TRC2AN
- End If
- '-------------------------------------------------------------------------------------------------------------
- '启动TRM AN
- '-------------------------------------------------------------------------------------------------------------
- If Format(Time, "h:mm") = "10:30" Then '自动启动时间
- Call comb_TRM6AN
- End If
- '-------------------------------------------------------------------------------------------------------------
- '启动TRB&TRD AN
- '-------------------------------------------------------------------------------------------------------------
- If Format(Time, "h:mm") = "12:30" Then '自动启动时间
- Call comb_TrbTrdAN
- End If
- '-------------------------------------------------------------------------------------------------------------
- '启动TRB&TRC&TRM AN
- '-------------------------------------------------------------------------------------------------------------
- If Format(Time, "h:mm") = "16:20" Then '自动启动时间
- Call comb_TrbTrcTrmAN
- End If
- '-------------------------------------------------------------------------------------------------------------
- '12:00点、17:30点、22点自动保存
- '-------------------------------------------------------------------------------------------------------------
- If Format(Time, "h:mm") = "12:00" Or Format(Time, "h:mm") = "17:30" Or Format(Time, "h:mm") = "22:00" Then '自动启动时间
- ThisWorkbook.Save '自动保存整个工作簿
- End If
- '-------------------------------------------------------------------------------------------------------------
- If CStr(Hour(Now())) = "5" And CStr(Minute(Now())) = "30" Then
- Sheet1.Range("A12").Value = 0
- ' Sheet6.UsedRange.Offset(1).Clear
- ' Sheet7.UsedRange.Offset(1).Clear
- ' Sheet9.UsedRange.Offset(1).ClearContents
- End If
- Call run_Timer
- Application.ScreenUpdating = True
- End Sub
复制代码
现在的问题是:
1、因为它已经是每分钟都在检测启动时间,到时间了就会自启动,但为什么有时又不能自启动了呢?
2、想把上面列出的模块1里的代码的启动时间重新给它组织一下,看起来很凌乱是不是也会影响启动?
|
|