MsgBox
13.12.2018 09:37:18
Erik
Ich habe diesen Code:
Sub EMailSenden()
Dim objOL As Object
Dim objMail As Object
Dim Bezeichnung As String
Dim EMailan As String
Dim strName As String
Dim intLZ As Integer
Dim i As Integer
Dim Info As String
Set objOL = CreateObject("Outlook.Application")
With Sheets("Kundenteile")
intLZ = .Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To intLZ
If .Cells(i, 14).Value = "a" Then
Set objMail = objOL.CreateItem(0)
EMailan = .Range("AB" & i).Value
With objMail
.To = EMailan
.Subject = "Terminvereinbarung - "
.Body = Range("AD" & i) & " " & Range("AC" & i) _
& vbCrLf & "" _
& vbCrLf & "Ihre bestellten Ersatzteile sind bei uns eingetroffen." _
.Display
End With
.Cells(i, 10).Value = Date ' oder auch Now für Datum + Uhrzeit"
Info = "*KD Info per eMail*"
Cells(i, 11) = Cells(i, 11) & " " & Info
.Cells(i, 14).ClearContents
End If
Next i
End With
MsgBox ("eMails wurde erfolgreich versendet!")
End Sub
Dieser funktioniert bis auf eine Sache super.Ich bräuchte eine Meldung, wenn keine E-Mail versendet wird.
Zur Zeit kommt immer: eMails wurde erfolgreich versendet!
Auch wenn keine gesendet wird.
Gruß
Erik