der nachstehend Code sendet problemlos eine Kopie der aktiven Mappe als Anhang an Emailadressen per OL.
Sie werden aber als Text verschickt und nicht im Html-Format.
In
.BodyFormat = olFormatHTML
erkennt Vba "olFormatHtml" nicht und meldet es als nicht definierte Variable.
Verweis auf Microsoft Outlook 9.0 Object Library ist gesetzt.
Recherche im Internet half mir nicht direkt weiter, einzig stiess ich sehr oft auf die gleiche Codezeile, scheinbar läuft sie überall nur nicht bei mir :-)
Was kann ich machen um die Codezeile zum laufen zu kriegen?
Danke ^ Gruß
Reinhard
Option Explicit
Sub E_Mail_starten()
Dim objOL As Outlook.Application
Dim objMail As Outlook.MailItem
Dim sBodyHeader As String
Dim sBodyText As String
Dim sBodyFooter As String
Dim MyMessage As Object, MyOutApp As Object
Dim SavePath As String
Dim AWS As String
SavePath = "c:\"
AWS = SavePath & "TEST.xls"
ActiveWorkbook.SaveCopyAs AWS
Set objOL = CreateObject("Outlook.Application")
Set objMail = objOL.CreateItem(olMailItem)
sBodyHeader = "head"
sBodyText = "Text"
sBodyFooter = "fuß"
With objMail
.Subject = "TEST"
'.BodyFormat = olFormatHTML
.HTMLBody = sBodyHeader & sBodyText & sBodyFooter
.To = "abc@xyz.de"
.CC = "abc@xyz.de"
.Attachments.Add AWS
'.Display
.Send
End With 'objMail
Kill AWS
Set objMail = Nothing
Set objOL = Nothing
End Sub