Range als HTML i eien Mail pasten

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hallo,

will mit folgendem COde eine Range in eine Mail einfügen.

Sub test()

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

rngesend = Selection

With OutMail

.To = ""
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.HTMLBody =
ActiveWorkbook.PublishObjects.Add(SourceType:=xlSourceRange,
Filename:="C:\tempsht.htm", Sheet:=rngesend.Parent.Name,
Source:=rngesend.Address, HtmlType:=xlHtmlStatic)
.Display
End With

End Sub

Bei der Zeile HTML body kommt immer eine Fehlermeldung (Obejct required).
Kann mirjemand helfen?

Vielen Dank
Martin

.



Relevant Pages

  • Re: E-Mailing
    ... Sub Mail_Workbook_Outlook_1 ... Dim OutApp As Object ... Set OutApp = CreateObject ... Set OutMail = OutApp.CreateItem ...
    (microsoft.public.excel.programming)
  • RE: VBE opens automatically -- why??
    ... Private Sub Workbook_SheetFollowHyperlink(ByVal Sh As Object, ... Dim OutMail As Object ... Set OutApp = CreateObject ... Set OutMail = OutApp.CreateItem ...
    (microsoft.public.excel.programming)
  • Re: E-mail to every e-mail address in an Excel column?
    ... >> Sub Mail_workbook_Outlook ... Dim OutMail As Object ... Set OutApp = CreateObject ... Set OutMail = OutApp.CreateItem ...
    (microsoft.public.excel.misc)
  • Re: Newbie help e-mail addresses
    ... > Sub Mail_Outlook ... Dim OutApp As Outlook.Application ... Set OutApp = CreateObject ... Set OutMail = OutApp.CreateItem ...
    (microsoft.public.excel)
  • VBE opens automatically -- why??
    ... Private Sub Workbook_SheetFollowHyperlink(ByVal Sh As Object, ... Dim OutMail As Object ... Set OutApp = CreateObject ... Set OutMail = OutApp.CreateItem ...
    (microsoft.public.excel.programming)