Mail+Anhang per Excel-Makro
05.09.2019 09:58:36
Hans
ich muss monatlich Mails (via Outlook 2010) an verschiedene Empfänger mit abweichenden Anhängen versenden. Um dies zu automatisieren habe ich ein Makro im Internet gefunden. Dies funktioniert auch wunderbar. Gibt es hierbei noch die Möglichkeit mehrere Empfänger in "cc" einzubauen? Über Recherche im Internet konnte ich leider nichts finden (Makro-Kenntnisse sind bei mir auch nicht vorhanden).
Schon einmal vielen Dank im Voraus.
Sub AnlagenMailen()
Dim oOL As Object
Dim oOLMsg As Object
Dim oOLRecip As Object
Dim oOLAttach As Object
Dim iRow As Integer, iCounter As Integer
Dim sFile, sRec As String, s
Sub As String
Dim sBody As String
Dim bln, S
Application.ScreenUpdating = False
iRow = Cells(Rows.Count, 1).End(xlUp).Row
Set oOL = CreateObject("Outlook.Application")
For iCounter = 2 To iRow
sRec = Cells(iCounter, 1) 'An
sFile = Split(Cells(iCounter, 5), ";") 'Anlage
s
Sub = Cells(iCounter, 3) 'Betreff
sBody = Cells(iCounter, 4) 'Text
Set oOLMsg = oOL.CreateItem(0)
With oOLMsg
Set oOLRecip = .Recipients.Add(sRec)
.Subject = sSub
.Body = sBody & vbLf & vbLf
For S = 0 To UBound(sFile)
.Attachments.Add sFile(S)
Next S
'.display
.Send
End With
oOLRecip.Resolve
Next iCounter
Set oOL = Nothing
End Sub
LG Hans