Last active
February 9, 2016 13:47
-
-
Save huangyg11/e57203bbdcc914eb490e to your computer and use it in GitHub Desktop.
Save word to pdf and open it with viewer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub SaveAsPdf() | |
' | |
' | |
' | |
Dim filename As String | |
filename = ActiveDocument.Path & "\" _ | |
& CreateObject("scripting.filesystemobject").getbasename(ActiveDocument) _ | |
& ".pdf" | |
ActiveDocument.ExportAsFixedFormat OutputFileName:= _ | |
filename, 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 a | |
Dim s As String | |
s = "e:\SumatraPDF\SumatraPDF.exe -reuse-instance " & Chr(34) & filename & Chr(34) | |
a = Shell(s, 1) | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment