Public
Sub
cmdbtn_eMail_generieren_Click()
Dim
OutApp
As
Object
, OutMail
As
Object
, strbody
As
String
Dim
i
As
Long
, strAddressat
As
String
Set
OutApp = CreateObject(
"Outlook.Application"
)
Set
OutMail = OutApp.CreateItem(0)
With
Worksheets(
"Mailadressen"
)
For
i = 1
To
.Cells(.Rows.Count,
"A"
).
End
(xlUp).Row
If
.Cells(i,
"B"
) <>
""
Then
If
CDate
(.Cells(i,
"B"
)) >
Date
Then
If
strAddressat = vbNullString
Then
strAddressat = .Cells(i,
"A"
)
Else
strAddressat = strAddressat &
";"
& .Cells(i,
"A"
)
End
If
End
If
End
If
Next
i
End
With
strbody = Sheets(
"Maildata"
).Range(
"A1"
).Value
On
Error
Resume
Next
With
OutMail
.to = strAddressat
.CC = eMail_Cc
.BCC = eMail_BCc
.Subject = Sheets(
"Maildata"
).Range(
"B6"
).Value
.HTMLBody = strbody &
"<br>"
& .HTMLBody
.Display
End
With
On
Error
GoTo
0
Set
OutMail =
Nothing
Set
OutApp =
Nothing
End
Sub