Option
Explicit
Private
MYPATH
As
String
Sub
MacroMitDeinemFormularSteuerelementVerknuepfen()
Dim
sText
As
String
MYPATH = Environ(
"temp"
)
sText =
"<div>Sehr ....<br>"
sText = sText &
"<p>foo bar bar foo</p>"
sText = sText &
"<br>MfG</div>"
Call
SendSheetOutlook( _
"Betreffzeile"
, _
"EMailAnZeile_als_Emailadresse_getrennt_durch_Simikolon"
, _
"EmailCCZeile"
, _
sText)
End
Sub
Private
Sub
SendSheetOutlook(sSubject
As
String
, sTo
As
String
, sCC
As
String
,
ByVal
sText
As
String
)
Dim
olApp
As
Object
Dim
AWS
As
String
Dim
olOldBody
As
String
AWS = MYPATH &
"\" & Format(Date, "
YYYYMMDD
") & "
_
" & Format(Time, "
hhmmss
") & "
_" & _
WorksheetFunction.Substitute(ActiveWorkbook.Name,
".xlsm"
,
""
)
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=AWS, Quality:=xlQualityStandard, _
IncludeDocProperties:=
True
, IgnorePrintAreas:=
False
, OpenAfterPublish:=
False
AWS = AWS &
".pdf"
Set
olApp = CreateObject(
"Outlook.Application"
)
With
olApp.CreateItem(0)
.GetInspector.Display
olOldBody = .htmlBody
.
To
= sTo
.cc = sCC
.Subject = sSubject
.htmlBody = sText & olOldBody
.Attachments.Add AWS
End
With
End
Sub