昨天搞到晚上8点多,不容易啊,贴一下,查资料太难了,对于C#程序员是个绝大的考验啊,点不出来的感觉。。。。
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim recips As Outlook.Recipients
Dim strCs As String
Dim intCount As Integer
Dim flag As Integer
Dim i As Integer
Dim j As Integer
strUsers = Array("asan@163.com", "li4@163.com")'必须包含的邮箱数据
Set recips = Item.Recipients'所有收件人
intCount = Item.Attachments.Count'附件数量
If intCount <> 0 Then'附件数量大于0则进行校验
For i = 0 To UBound(strUsers)'没有Count属性,没有Length属性,只能用UBound函数获取数组上标
flag = 0
For j = 1 To recips.Count'下标居然从1开始的。。。
strCc = recips.Item(j).Address
If recips.Item(j).Type = olCC Then'只有抄送者才检测
If strCc = strUsers(i) Then
flag = 1
Exit For
End If
End If
Next
If flag = 0 Then
Prompt$ = "存在附件的Mail中【" & strUsers(i) & " 】没有

这篇博客讲述了作者在使用VBA进行编程时,如何实现检查Outlook邮件的抄送人列表中是否包含指定邮箱地址的过程。作为C#程序员,作者在解决这个问题时遇到了挑战,因为操作方式与C#有所不同。

2万+

被折叠的 条评论
为什么被折叠?



