|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
修改后的 请测试
- 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
- On Error Resume Next
- Dim myItem As outlook.MailItem
- Dim arrto
- Dim arrcc
- Dim myTo As String
- Dim mycc As String
- Set myItem = Item
- '这里填写你要密送的邮箱
- Debug.Print myItem.CC; myItem.To
- arrto = Split(myItem.To, ";")
- arrcc = Split(myItem.CC, ";")
- For i = 0 To UBound(arrto)
- If Not arrto(i) Like "*@163.com" Then
- strBcc = strBcc & arrto(i) & ";"
- arrto(i) = ""
- End If
- Next
-
- myTo = Join(arrto, ";")
- For i = 0 To UBound(arrcc)
- If Not arrcc(i) Like "*@163.com" Then
- strBcc = strBcc & arrcc(i) & ";"
- arrcc(i) = ""
- End If
- Next
- mycc = Join(arrcc, ";")
- Set objRecip = myItem.Recipients.Add(strBcc)
- myItem.To = Trim(myTo)
- myItem.CC = Trim(mycc)
- objRecip.Type = olBCC
- If Not objRecip.Resolve Then
- strMsg = "不能解析密件抄送人邮件地址, " & _
- "请确认是否仍然发送邮件?"
- res = MsgBox(strMsg, vbYesNo + vbDefaultButton1, _
- "不能解析密件抄送人邮件地址")
- If res = vbNo Then
- Cancel = True
- End If
- End If
- Set objRecip = Nothing
- End Sub
复制代码 |
|