嗨,我是VBA的新手,我不断在电子表格上每隔一段时间弹出一次错误信息。我怎么知道造成这种情况的原因?
以下是对我的代码的引用:
Private Sub Worksheet_Calculate()
Dim OutApp As Object
Dim OutMail As Object
Dim Target As Double
Dim bRun As Boolean
Dim iHour As Integer
'On Error GoTo debugtest
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
Target = ThisWorkbook.Sheets("Quotes").Range("Q1")
'Reset the trigger flag if the last triggered time was yesterday or earlier
If Day(Now()) <> Day(ThisWorkbook.Sheets("Quotes").Range("Q3")) Then
'Sheets("Quotes").Range("Q2") = False
End If
bRun = False
iHour = Application.WorksheetFunction.Text(Time(), "[hh]")
If iHour >= ThisWorkbook.Sheets("Quotes").Range("Q9") Or iHour <= ThisWorkbook.Sheets("Quotes").Range("Q10") Then
bRun = True
End If
我该怎么办?