我有件事会在事情发生前一小时通知我。为此,我使用 VBA 中的 NOW 函数,因为我还需要它来检查日期。
问题是脚本每 20 秒运行一次,所以我不能让它考虑 NOW 函数的秒数。
有办法去除那些吗?只拥有(日,月,年,小时,分钟)之类的东西?
沿着这些思路:
MyLimit = NOW(DAY,MONTH,YEAR,HOUR,MINUTE)
For Each FormulaCell In FormulaRange.Cells
With FormulaCell
If .Value = MyLimit Then
Call Notify
Run Code Online (Sandbox Code Playgroud)
这是我尝试检测日期和时间的脚本。
Option Explicit
Public Function AutoRun()
Application.OnTime Now + TimeValue("00:00:20"), "TaskTracker2"
End Function
Public Sub TaskTracker2()
Dim FormulaCell As Range
Dim FormulaRange As Range
Dim NotSentMsg As String
Dim MyMsg As String
Dim SentMsg As String
Dim SendTo As String
Dim CCTo As String
Dim BCCTo As String
Dim MyLimit As …Run Code Online (Sandbox Code Playgroud)