-1
我需要在Outlook 2016中創建一個規則,當「CC:」字段中有超過10個電子郵件地址時,該規則將彈出警告。如何根據「CC:」地址的數量制定Outlook規則?
我在一個快速的谷歌搜索找到了這個結果,它做了同樣的事情,但與「收件人:」字段中的電子郵件地址。我是VBA的新手,因此我不確定需要更改哪條線來切換它以查看CC電子郵件而不是To。
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim Recipients As Integer
Dim Start As Integer
Dim Last As Integer
Recipients = 1
Do
Start = Last + 1
Last = InStr(Start, Item.To, ";")
If Last = 0 Then Exit Do
Recipients = Recipients + 1
Loop
If (Recipients > 10) Then
Cancel = (MsgBox(Str(Recipients) & " recipients in To field.", vbOKCancel) = vbCancel)
End If
End Sub
'item.cc' https://msdn.microsoft.com/VBA/Outlook-VBA/articles/mailitem-cc-property-outlook –
另外,'Recipients = ubound(split(item.cc,「;」))'應該做count,所以不需要代碼到IF –