代码如下:
Sub olFromSysItems_ItemAdd(ByVal item As Object)
Dim EventMessage As String
Dim strErrMessage As String
Dim objMailFromSys As clsMailFromSys
On Error GoTo Error_Handler
Set objMailFromSys = New clsMailFromSys
objMailFromSys.SetMailObject item
If objMailFromSys.Function1(strErrMessage) = False Then
GoTo Error_Handler
End If
If objMailFromSys.Function2(strErrMessage) = False Then
GoTo Error_Handler
End If
If objMailFromSys.Function3(strErrMessage) = False Then
GoTo Error_Handler
End If
item.Move folderFromSys_Processed
Set objMailFromSys = Nothing
Exit Sub
Error_Handler:
EventMessage = "Error email from " & item.SenderName & "." & Chr(12)
If Len(Trim(strErrMessage)) = 0 Then
EventMessage = EventMessage & "olFromSysItems_ItemAdd Error: " & Err.Description & Chr(12)
Else
EventMessage = EventMessage & strErrMessage & Chr(12)
End If
EventMessage = EventMessage & "Please also check the email folder Error"
EventMessage = Chr(34) & EventMessage & Chr(34)
LogEvent EventMessage
Set objMailFromSys = Nothing
item.Move folderError
SendErrorMessageToAdmin "Error Email from VBA", EventMessage, item
End Sub
偶尔会出现以下行的错误:
item.Move folderError
出现以下错误消息:
由于原始项目,项目被复制而不是移动 无法删除。无法删除该项目。它被移动或已被删除,或访问被拒绝。
我的问题:
答案 0 :(得分:0)
如果你还没有找到另一种方法,那么绕过这个错误就可以了。
' Use only for a specific purpose
On Error Resume Next
item.Move folderError
' Turn error bypass off once the purpose for it has been served
On Error GoTo 0