Ich benutze ein Makro für Bewerbungen und es funktioniert hervorragend bei Office 2013. Jetzt wollte ich es bei meiner Freundin mit Office 2003 einrichten. Alles funktioniert super soweit. Die Email wird aus Excel heraus erstellt, Email adresse wird eingetragen, der Betreff und die Anlagen setzen sich auch rein.
Nur der Emailtext bleibt leer.
Anrede und Text soll er auf der Seite "Text" aus A2 und B2 holen.
Könnt Ir mir bitte sagen, woran das liegt?
Hier ist das Makro:
Option Explicit
Sub Email_mit_Anhang()
Dim sSheet As String
Dim sText As String
Dim sTo As String
Dim sSubject As String
Dim sAttach As String
Dim lRow As Long
Dim myRng As Range
With ActiveSheet
lRow = .Cells(.Rows.Count, 1).End(xlUp).Row
sSubject = Sheets("Text").Range("A2").Value 'Betreff
For Each myRng In .Range(.Cells(2, 1), .Cells(lRow, 1))
If myRng.Value = "x" Then
sTo = .Cells(myRng.Row, 11).Value 'Emailadresse
sText = ""
sText = sText & .Cells(myRng.Row, 6) & "
" 'Anrede
sText = sText & Sheets("Text").Range("B2").Value 'Emailtext
sAttach = .Cells(myRng.Row, 13)
Call SendMailOutlook(sSubject, sTo, sText, sAttach) 'verschicken
End If
Next myRng
End With
End Sub
Private Sub SendMailOutlook(sSubject, sTo, sText, sAttach)
Dim olApp As Object
Dim olOldBody As String
'Make Email
Set olApp = CreateObject("Outlook.Application")
With olApp.CreateItem(0)
.GetInspector.Display
olOldBody = .htmlbody
.To = sTo
.Subject = sSubject
.htmlbody = sText & olOldBody
If sAttach "" Then
.Attachments.Add sAttach
End If
If Sheets("Text").Range("C2").Value "" Then
.Attachments.Add Sheets("Text").Range("C2").Value
End If
If Sheets("Text").Range("D2").Value "" Then
.Attachments.Add Sheets("Text").Range("D2").Value
End If
If Sheets("Text").Range("E2").Value "" Then
.Attachments.Add Sheets("Text").Range("E2").Value
End If
If Sheets("Text").Range("F2").Value "" Then
.Attachments.Add Sheets("Text").Range("F2").Value
End If
If Sheets("Text").Range("G2").Value "" Then
.Attachments.Add Sheets("Text").Range("G2").Value
End If
End With
End Sub
Vielen Dank für die Hilfe,
Larissa