Sub
PDFundSenden()
Const
DateiPfad = "K:\Mail\"
Dim
DateiName
As
String
DateiName = DateiPfad &
"NPL"
& Space(1) & Range(
"Daten!B4"
) & Space(1) & Range(
"Daten!B2"
) & Space(1) & Range(
"Daten!B3"
) & Space(1) & Format(
Date
,
"YYYY-MM-DD"
) &
".pdf"
Sheets(
"Ausgabe"
).Range(
"A1:E86"
).ExportAsFixedFormat Type:=xlTypePDF, Filename:=DateiName, _
Quality:=xlQualityStandard, IncludeDocProperties:=
True
, IgnorePrintAreas:=
False
, OpenAfterPublish:=
False
Dim
Outlook
As
Object
Dim
OutlookmailItem
As
Object
Dim
myAttachments
As
Object
Set
OutlookApp = CreateObject(
"outlook.application"
)
Set
OutlookmailItem = OutlookApp.CreateItem(0)
Set
myAttachments = OutlookmailItem.Attachments
With
OutlookmailItem
.to =
""
.Subject =
"Nettopreisliste vom "
& Format(
Date
,
"DD.MM.YYYY"
)
.body =
"Sehr geehrte Damen und Herren,"
_
& vbLf & vbLf &
"Anbei finden Sie die PDF mit Ihrer Preisliste, bitte entnehmen Sie dieser sorgfältig alle Informationen."
_
& vbLf & vbLf & vbLf &
""
_
& vbLf & vbLf &
"Mit freundlichen Grüßen."
& vbLf & strMaterial
myAttachments.Add DateiName
.display
End
With
Set
OutlookApp =
Nothing
Set
OutlookmailItem =
Nothing
End
Sub