这个宏在“干净”的新电子邮件中使用时效果很好。但是,当我回复或转发电子邮件时,我会收到VBA
错误91 - 对象变量或未设置块变量
('',)
/**
* @mixin \Eloquent
* @mixin \Illuminate\Database\Eloquent\Builder
*/
是我需要调试的行。感谢
答案 0 :(得分:0)
我猜测回复或转发位于Outlook底部的窗格中,ActiveInlineResponse
窗格。我最近修改了一些代码来考虑该窗格。如果是这样的话,这样的事可能适合你:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
If TypeOf Item Is Outlook.MailItem And Len(Item.Categories) = 0 Then
If Not Application.ActiveExplorer.ActiveInlineResponse Is Nothing Then
Set Item = Application.ActiveExplorer.ActiveInlineResponse
End If
'If the draft is in it's own window
If OutItem Mail Is Nothing Then
If Not Application.ActiveInspector Is Nothing Then
Set Item = Application.ActiveInspector.CurrentItem
Item.ShowCategoriesDialog
End If
End Sub
此代码未经测试,我可能没有正确粘贴/修改所有内容。
答案 1 :(得分:0)
项目传递给ItemSend,您无需自己找到它。
'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
Item.ShowCategoriesDialog
End If
End Sub