我写了一个宏来在回复窗口添加BCC地址。但我想点击“回复”按钮也一样。我无法将宏添加到此按钮,因为它不是自定义按钮。我该怎么做?
答案 0 :(得分:0)
您可以重新调整内置控件的用途。但在这种情况下,您需要开发一个加载项,而不是VBA宏。有关详细信息,请参阅Temporarily Repurpose Commands on the Office Fluent Ribbon。
此外,您可以尝试处理Application类的ItemSend事件,该事件在用户通过Inspector发送Microsoft Outlook项目时触发(在检查器关闭之前,但在用户点击之后) “发送”按钮)或在程序中使用Outlook项目的Send方法(如MailItem)时。在事件处理程序中,您可以尝试使用'类型'添加新条目到Recipients集合(请参阅相应的属性)。属性设置为olBcc。
答案 1 :(得分:0)
这是来自超级用户。
https://superuser.com/questions/327614/outlook-macro-to-interrupt-a-reply-all
“您可以通过VBA添加事件处理程序来获取ReplyAll事件。如下所示:”
Dim WithEvents insp As Outlook.Inspectors
Dim WithEvents mailItem As Outlook.MailItem
' This is called on Outlook startup
Private Sub Application_Startup()
Set insp = Application.Inspectors
End Sub
' This is called when a new Inspector is created.
' You use it to pick up on a new mail item event
Private Sub insp_NewInspector(ByVal Inspector As Inspector)
' Edit: The size test appears to be incorrect
'If Inspector.CurrentItem.Size = 0 And Inspector.CurrentItem.Class = olMail Then
If Inspector.CurrentItem.Class = olMail Then
Set mailItem = Inspector.CurrentItem
End If
End Sub
' Called when you press ReplyAll
Private Sub mailItem_ReplyAll(ByVal Response As Object, Cancel As Boolean)
Dim msg As String
Dim result As Integer
msg = "Do you really want to reply to all?"
result = MsgBox(msg, vbYesNo, "Reply All Check")
If result = vbNo Then
Cancel = True
End If
End Sub
将代码放入ThisOutlookSession模块,然后重新启动。