Per Aprire VBA ALT + F11 da outlook aperto
[code language=”vb”]
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
‘ #### USER OPTIONS ####
‘ address for Bcc — must be SMTP address
‘ or resolvable to a name in the address book
strBcc = "address@domain.com"
Set objRecip = Item.Recipients.Add(strBcc)
objRecip.Type = olBCC
If Not objRecip.Resolve Then
strMsg = "Could not resolve the Bcc recipient. " & _
"Do you want to send the message?"
res = MsgBox(strMsg, vbYesNo + vbDefaultButton1, _
"Could Not Resolve Bcc")
If res = vbNo Then
Cancel = True
End If
End If
Set objRecip = Nothing
End Sub
[/code]
BCC Messages sent From a Specific Account
If you have multiple accounts in your profile and only want to BCC messages sent through a specific account, use an IF statement to check the SendUsingAccount value. Be sure to use the account name as it appears in the From field or Account Settings dialog.
To BCC from all but one account, replace the = sign in the If statement with <>.
[code language=”vb”]
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
strBcc = "alias@domain.com"
‘ Use the account name as it appears in Account Settings
If Item.SendUsingAccount = "account@domain.com" 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 to send the message?"
res = MsgBox(strMsg, vbYesNo + vbDefaultButton1, _
"Could Not Resolve Bcc")
If res = vbNo Then
Cancel = True
End If
End If
End If
Set objRecip = Nothing
End Sub
[/code]