重新安装 Outlook 后,我的 VBA 自动密件抄送功能不起作用

重新安装 Outlook 后,我的 VBA 自动密件抄送功能不起作用

重新安装 Outlook 2010 后,我的 BBC 代码自动不再起作用!有什么办法可以让它再次起作用吗?非常感谢!

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim objRecip As Recipient
Dim strMsg As String
Dim res As Integer
Dim strBcc As String
Dim myOlApp As Outlook.Application
Dim myOlMsg As Outlook.MailItem

On Error Resume Next

' create outlook objects for referance
Set myOlApp = CreateObject("Outlook.Application")
Set myMsg = myOlApp.ActiveInspector.CurrentItem

' address to BCC
strBcc = "[email protected]"

' if the sender address is the support account utilize bcc
If myMsg.SenderEmailAddress = "[email protected]" Then
  Set objRecip = Item.Recipients.Add(strBcc)
  objRecip.Type = olBCC
  If Not objRecip.Resolve Then
    strMsg = "Could not resolve the Bcc recipient. " & _
    "Do you want still to send the message?"
    res = MsgBox(strMsg, vbYesNo + vbDefaultButton1, _
    "Could Not Resolve Bcc Recipient")
    If res = vbNo Then
      Cancel = True
    End If
  End If
  Set objRecip = Nothing
End If
End Sub

仅供参考,我将这个 VBA 脚本放在“ThisOutlookSession”对象中 我的 vba 位置 ,再次供您参考,我已经完成了“向我发送的每封邮件的副本”的操作,并在“规则和警报”中添加了一些提示,但仍然想知道为什么此代码不起作用。

答案1

检查宏安全级别http://www.slipstick.com/outlook-developer/how-to-use-outlooks-vba-editor/ Outlook 2010:文件、选项、信任中心、宏。

相关内容