VBA宏-自定义回复按钮 [英] VBA Macro - customize Reply Button
本文介绍了VBA宏-自定义回复按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我写了一个宏,在回复窗口中添加密件抄送地址.但是我想在单击答复"按钮上做同样的事情.我不能将宏添加到此按钮,因为它不是自定义按钮.我该怎么办?
I've written a macro to add BCC address on reply window. But I want to do the same on click of 'Reply' Button. I can not add macro to this button as it is not custom button. How should I do this?
推荐答案
这是来自超级用户.
https://superuser.com/questions/327614/outlook-macro中断所有回复
您可以通过VBA添加事件处理程序以接收ReplyAll事件.类似于以下内容:"
"You can add an event handler via VBA to pick up the ReplyAll event. Something like the following:"
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模块中,然后重新启动.
Put the code in the ThisOutlookSession module then restart.
这篇关于VBA宏-自定义回复按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文