Sub
PDF_und_Senden()
Dim
Dateiname
As
String
Dim
Outlook
As
Object
, OutlookApp
As
Object
, OutlookMailItem
As
Object
Dim
myAttachments
As
Object
Dim
ws
As
Worksheet
Set
ws = ThisWorkbook.Sheets(
"Sheet1"
)
Dateiname = ws.Range(
"K3"
) &
"\" & ws.Range("
K2
") & "
.pdf"
ws.Range(
"A1:G48"
).ExportAsFixedFormat Type:=xlTypePDF, Filename:=Dateiname, Quality:=xlQualityStandard, IncludeDocProperties:=
True
, IgnorePrintAreas:=
False
, OpenAfterPublish:=
True
Set
OutlookApp = CreateObject(
"Outlook.Application"
)
Set
OutlookMailItem = OutlookApp.CreateItem(0)
Set
myAttachments = OutlookMailItem.Attachments
With
OutlookMailItem
.
To
= Range(
"K16"
)
.Subject = Range(
"K17"
)
.Body = Range(
"K37"
)
myAttachments.Add Dateiname
.Display
End
With
Set
OutlookApp =
Nothing
Set
OutlookMailItem =
Nothing
End
Sub