AW: Nur Bestimmte Angezeigte Spalten per Email schicke
03.12.2014 09:18:09
Tino
Hallo,
hier ein Beispiel.
Die PDF wird im Ordner der Exceldatei gespeichert.
Sub Excel_zu_PDF_Mail()
Dim sPath$
Dim MyOutApp As Object, MyMessage As Object
sPath = IIf(Right$(ThisWorkbook.Path, 1) = "\", _
ThisWorkbook.Path, ThisWorkbook.Path & "\")
With Tabelle1 'Tabelle anpassen
sPath = sPath & .Name & ".pdf"
.Columns("A:C").AutoFit
.PageSetup.PrintArea = "A:C"
.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
sPath, Quality:=xlQualityStandard, _
IncludeDocProperties:=False, IgnorePrintAreas:=False, OpenAfterPublish:=False
.PageSetup.PrintArea = ""
End With
Set MyOutApp = CreateObject("Outlook.Application")
Set MyMessage = MyOutApp.CreateItem(0)
With MyMessage
.To = "Hier kommt die Adresse rein"
.Subject = "Excel zu PDF"
.body = "hier ist die PDF"
.Attachments.Add sPath
.Importance = 2 'Wichtigkeit hoch
.Display
'.Send 'Hier wird die Mail gesendet
End With
Set MyOutApp = Nothing
Set MyMessage = Nothing
End Sub
Gruß Tino