Sub SendForm()
'
MsgBox "Vul hierna de naam van de deelnemer in. Het PDF-bestand is te vinden in de gedeelde mappen", vbInformation, "Belangrijk bericht voor docenten Groen"
Naam = InputBox("Geef hieronder de naam van het bestand/deelnemer op.", "Toekomstige naam van het PDF-Bestand")
ChangeFileOpenDirectory "G:\MBO\MBO Groen\Cijferadministratie\2015\Resultatenlijsten van deelnemers in PDF"
ActiveDocument.ExportAsFixedFormat OutputFileName:=Naam, ExportFormat:= _
wdExportFormatPDF, OpenAfterExport:=False, OptimizeFor:= _
wdExportOptimizeForPrint, Range:=wdExportAllDocument, From:=1, To:=1, _
Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _
CreateBookmarks:=wdExportCreateHeadingBookmarks, DocStructureTags:=True, _
BitmapMissingFonts:=True, UseISO19005_1:=False
Dim vDoc As Object
Dim vPath As String
vPath = ActiveDocument.Path & Application.PathSeparator & "Resultatenoverzicht.pdf"
ActiveDocument.ExportAsFixedFormat OutputFileName:=vPath, _
ExportFormat:=wdExportFormatPDF, OpenAfterExport:=False, OptimizeFor:= _
wdExportOptimizeForPrint, Range:=wdExportAllDocument, From:=1, To:=1, _
Item:=wdExportDocumentWithMarkup, IncludeDocProps:=False, KeepIRM:=True, _
CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _
BitmapMissingFonts:=True, UseISO19005_1:=False
Call Mail_Workbook_1(vPath)
Kill vPath
End Sub
Sub Mail_Workbook_1(vPath As String)
' Works in Excel 2000, Excel 2002, Excel 2003, Excel 2007, Excel 2010, Outlook 2000, Outlook 2002, Outlook 2003, Outlook 2007, Outlook 2010.
' This example sends the last saved version of the Activeworkbook object .
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
' Change the mail address and subject in the macro before you run it.
With OutMail
.To = ""
.CC = ""
.BCC = ""
.Subject = "Overzicht van resultaten tot nu toe."
.Body = "Beste deelnemer," & vbNewLine & " " & vbNewLine & "Hierbij jouw resultatenoverzicht tot nu toe." & vbNewLine & " " & vbNewLine & "Heb je vragen over deze mail en de inhoud daarvan? Neem dan contact op met jouw coach." & vbNewLine & " " & vbNewLine & "Met vriendelijke groet,"
.Attachments.Add vPath
' You can add other files by uncommenting the following line.
'.Attachments.Add ("C:\Resultatenoverzicht")
' In place of the following statement, you can use ".Display" to
' display the mail.
.Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub