Sub
Button_Screenshot_Mail()
Range(
"J1:S34"
).CopyPicture xlScreen, xlBitmap
Dim
oApp
As
Object
Set
oApp = CreateObject(
"Outlook.Application"
)
On
Error
Resume
Next
With
oApp.CreateItem(0)
Application.Wait 1
.
To
=
"irgendwer"
.Subject =
"Das ist der Betreff"
.body =
"Text als Beschreibung"
.Display
SendKeys
"{END}"
,
True
SendKeys
"~"
,
True
SendKeys
"^v"
,
True
SendKeys
"~"
,
True
.GetInspector
End
With
On
Error
GoTo
0
Set
oApp =
Nothing
End
Sub
2. Eine PDF Datei aus einer Liste in der Arbeitsmappe xxx.xlsm (quasi einer anderen Arbeitsmappe) in dem Arbeitsblat
"xy"
den Befehl für die PDF Erstellung und e-mail Versand habe ich schon:
Sub
PDF_per_EMail()
Dim
strPDF
As
String
Dim
OutlookApp
As
Object
, strEmail
As
Object
Set
OutlookApp = CreateObject(
"Outlook.Application"
)
Set
strEmail = OutlookApp.CreateItem(0)
ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
ThisWorkbook.Path &
"\Excel-File.pdf"
, Quality:=xlQualityStandard _
, IncludeDocProperties:=
False
, IgnorePrintAreas:=
False
, OpenAfterPublish _
:=
False
strPDF = ThisWorkbook.Path &
"\Excel-File.pdf"
With
strEmail
.
To
=
"name@domain.tld"
.Subject =
"PDF als Anlage"
.body =
"Als Anlage die PDF-Datei"
.Attachments.Add strPDF
.Display
Kill strPDF
End
With
Set
OutlookApp =
Nothing
Set
strEmail =
Nothing
End
Sub