PDA

View Full Version : Saving as PDF and Opening document for viewing in one step



AnalystGuy
01-14-2016, 08:56 AM
I have this code which saves the document as a pdf in the proper folder but I want it to open up the newly saved PDF and close the Word Application as well. How would I code this?





ActiveDocument.SaveAs "R:\Group\Adverse Action Letter\ " & Me.TextBox5 & ".pdf"



Thank you!

gmayor
01-14-2016, 10:00 PM
Dim strDocName as String
strDocName = "R:\Group\Adverse Action Letter\ " & Me.TextBox5 & ".pdf"

ActiveDocument.ExportAsFixedFormat OutputFilename:=strDocName, _
ExportFormat:=wdExportFormatPDF, _
OpenAfterExport:=True, _
OptimizeFor:=wdExportOptimizeForPrint, _
Range:=wdExportAllDocument, From:=1, to:=1, _
Item:=wdExportDocumentContent, _
IncludeDocProps:=True, _
KeepIRM:=True, _
CreateBookmarks:=wdExportCreateHeadingBookmarks, _
DocStructureTags:=True, _
BitmapMissingFonts:=True, _
UseISO19005_1:=False
Application.Quit