E-Mail per VBA an Outlook-Gruppe
05.06.2021 13:59:57
Dirk
stehe wieder mal vor einem kleinen Problem. Ich möchte eine E-Mail aus Excel heraus an eine Outlokk-Gruppe senden. Die entsprechenden Adressen stehen in "Adressbuch -> Kontakte -> A OU Nord Probefahrten". Mit Versenden an eine einzelne Adresse ist das kein Problem (siehe Code), aber wie schaffe ich es, entsprechende Gruppen anzusprechen.
Hier mein bisheriger Code :
Sub CommandButton1_Click()
Dim DateiName As String
Dim OutlookApp As Object
Dim Outlook As Object
Dim OutlookMailItem As Object
Dim myAttachments As Object
Set OutlookApp = CreateObject("outlook.application")
Set OutlookMailItem = OutlookApp.CreateItem(0)
Set myAttachments = OutlookMailItem.Attachments
DateiName = Sheets("TTP").Range("$A$1") & "_" & Sheets("TTP").Range("$A$4") & ".pdf"
Sheets("Formular").ExportAsFixedFormat Type:=xlTypePDF, Filename:=DateiName, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
With OutlookMailItem
.to = Sheets("Email_To").Range("A1").Text
.Subject = Sheets("Email_Subject").Range("A1").Text
.Body = Sheets("Email_Body").Range("A1").Text
myAttachments.Add DateiName
.Display
.Send
End With
Set OutlookApp = Nothing
Set OutlookMailItem = Nothing
End Sub
Vielen Dank an die Experten im Voraus.