Sub SendEmails()
Dim OutlookApp As Object
Dim OutlookMail As Object
Dim MailRecipients As Worksheet
Dim LastRow As Long
Dim RecipientEmail As String
Dim SendStatus As String
Dim EmailSubject As String
Dim EmailText As String
Dim OutlookLogo As String
' Initialize Outlook
Set OutlookApp = CreateObject("Outlook.Application")
' Load the worksheet with recipient data
Set MailRecipients = Workbooks.Open("C:\TEMP\Mail_Empfaenger.xlsx").Sheets(1)
LastRow = MailRecipients.Cells(MailRecipients.Rows.Count, "A").End(xlUp).Row
' Loop through each row of data
For i = 2 To LastRow
' Create a new email for each recipient
Set OutlookMail = OutlookApp.CreateItem(0) ' 0: olMailItem
RecipientEmail = MailRecipients.Cells(i, 1).Value
SendStatus = MailRecipients.Cells(i, 2).Value
EmailSubject = MailRecipients.Cells(i, 3).Value
EmailText = MailRecipients.Cells(i, 4).Value
' Create the email
With OutlookMail
.To = RecipientEmail
.subject = EmailSubject
.htmlBody = EmailText & "<br><br><img src='C:\\TEMP\\Ziel.jpg' height='100' width='150'><br><br>" & " Weitere Text hier eingeben"
' Attach the image
.Attachments.Add "C:\TEMP\Ziel.jpg"
' Send or display based on the status
Select Case SendStatus
Case "Send"
.Send
Case "Anzeigen"
.Display
Case Else
' Do nothing
End Select
End With
Next i
' Close Outlook objects
Set OutlookMail = Nothing
Set OutlookApp = Nothing
' Display the message box with statistics
MsgBox "Emails Sent: " & LastRow - 1 & vbCrLf & "Emails Displayed: 0" & vbCrLf & "Do Nothing: 0", vbInformation
End Sub
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}