Gruppe
Extern
Bereich
Thema
Mehrere Arbeitsmappen per Outlook an einen Empfänger
Problem
Wie kann ich über Outlook gleichzeitig mehrere Arbeitsmappen an einen vorgegebenen Empfänger senden?
Lösung
Geben Sie den nachfolgenden Code in ein Standardmodul ein und weisen Sie ihn einer Schaltfläche zu.
StandardModule: modMain
Sub SendMessage()
Dim oOL As Object
Dim oOLMsg As Object
Dim oOLRecip As Object
Dim oOLAttach As Object
Dim iRow As Integer
Set oOL = CreateObject("Outlook.Application")
Set oOLMsg = oOL.CreateItem(0)
With oOLMsg
Set oOLRecip = .Recipients.Add(Range("E1").Value)
iRow = 2
Do Until IsEmpty(Cells(iRow, 1))
Set oOLAttach = .Attachments.Add(Cells(iRow, 1).Value)
iRow = iRow + 1
Loop
.Subject = Format(Date, "dd.mm.yy") & " - " & Format(Time, "hh:mm:ss")
.Body = "Beiliegend die Excel-Dateien"
.Send
End With
Set oOLRecip = Nothing
Set oOLMsg = Nothing
Set oOL = Nothing
End Sub