【发布时间】:2017-12-05 04:03:01
【问题描述】:
当用于“干净”的新电子邮件时,此宏可以正常工作。但是,当我回复或转发电子邮件时,我会收到 VBA
错误 91 - 对象变量或未设置块变量
Private WithEvents olRemind As Outlook.Reminders
Private Sub Application_Reminder(ByVal Item As Object)
Set olRemind = Outlook.Reminders
If Item.MessageClass <> "IPM.Task" Then
Exit Sub
End If
If Item.Categories <> "Online" Then
Exit Sub
End If
SetOnline
Timed_box (1)
Pause 30
SetOffline
Item.MarkComplete
Set olRemind = Outlook.Reminders
For Each objRem In olRemind
If Item.Categories = "Online" Then
If objRem.IsVisible Then
objRem.Dismiss
Cancel = True
End If
Exit For
End If
Next objRem
End Sub
'Categorize Sent Items
'Place in ThisOutlookSession
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
If TypeOf Item Is Outlook.MailItem And Len(Item.Categories) = 0 Then
Set Item = Application.ActiveInspector.CurrentItem
Item.ShowCategoriesDialog
End If
End Sub
Set Item = Application.ActiveInspector.CurrentItem 是我需要调试的行。谢谢
【问题讨论】: