Ich kann nicht den richtigen VBA-Code für Outlook 2013 herausfinden, um eine feste E-Mail-Adresse zum BCC-Feld einer E-Mail hinzuzufügen, während es zur Bearbeitung geöffnet ist. Ich habe den folgenden Code, der die E-Mail erstellt und dann den BCC setzt.BCC zu E-Mail mit VBA in Outlook 2013 hinzufügen
Ich möchte BCC zu E-Mails, die ich antworte, hinzufügen, so dass die Nachricht bereits in 'Entwurf' Form sein wird.
Sub sendcomment_click()
Set oMsg = Application.CreateItem(olMailItem)
With oMsg
.Recipients.Add ("email address")
'Set objRecip = Item.Recipients.Add("email address")
'objRecip.Type = olBCC
'objRecip.Resolve
' Join Email addresses by "; " into ".BCC" as string
.BCC = "[email protected]; [email protected]"
.Subject = "New Comment by"
.Body = "sdfsdfsdf"
.Display ' Comment this to have it not show up
'.Send ' Uncomment this to have it sent automatically
End With
Set oMsg = Nothing
End Sub
* Update *
ich die große Beratung von Dmitry implementiert
Mein Code lautet nun:
Sub BCC()
Dim objRecip As Recipient
Set oMsg = Application.ActiveInspector.CurrentItem
With oMsg
Set objRecip = item.Recipients.add("[email protected]")
objRecip.Type = olBCC
objRecip.Resolve
End With
Set oMsg = Nothing
End sub
Allerdings, wenn ich versuche, es zu laufen ich eine bekommen Fehler "Laufzeitfehler '424' Objekt erforderlich" und es markiert die Zeile:
Set objRecip = item.Recipients.Add("[email protected]")
Ersetzen Sie die Zeile "Set objRecip = item.Recipients.add (" [email protected] ")" mit "Set objRecip = oMsg.Recipients.add (" [email protected] ") " –