gibt es eine Möglichkeit mit vba ein Tabellenblatt als PDF in Outlook als Anhang zu versenden?
Gruß
Chris
Sub PrintToPDF_Early()
Dim pdfjob As PDFCreator.clsPDFCreator
Dim sPDFName As String
Dim sPDFPath As String
sPDFName = "testPDF.pdf"
sPDFPath = ActiveWorkbook.Path & Application.PathSeparator
If IsEmpty(ActiveSheet.UsedRange) Then Exit Sub
Set pdfjob = New PDFCreator.clsPDFCreator
With pdfjob
If .cStart("/NoProcessingAtStartup") = False Then
MsgBox "Can't initialize PDFCreator.", vbCritical + _
vbOKOnly, "PrtPDFCreator"
Exit Sub
End If
.cOption("UseAutosave") = 1
.cOption("UseAutosaveDirectory") = 1
.cOption("AutosaveDirectory") = sPDFPath
.cOption("AutosaveFilename") = sPDFName
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
ActiveSheet.PrintOut copies:=1, ActivePrinter:="PDFCreator"
Do Until pdfjob.cCountOfPrintjobs = 1
DoEvents
Loop
pdfjob.cPrinterStop = False
Do Until pdfjob.cCountOfPrintjobs = 0
DoEvents
Loop
pdfjob.cClose
Set pdfjob = Nothing
End Sub
Gruss Tino
Sub sendMail()
Dim mePDFD As String
Dim MyOutApp As Object, MyMessage As Object
mePDFD = ThisWorkbook.Path & "\testPDF.pdf"
Set MyOutApp = CreateObject("Outlook.Application")
Set MyMessage = MyOutApp.CreateItem(0)
With MyMessage
.To = "Meine E_mail Adresse"
.Subject = "hier ist die Test PDF Datei" 'Betreffzeile
.body = "geht doch!"
.Attachments.Add mePDFD
.Display
'.Send
Kill mePDFD
End With
Set MyOutApp = Nothing
Set MyMessage = Nothing
End Sub
Gruss Tino