View Single Post
 
Old 06-07-2017, 10:40 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,137
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

The following will save to the current user's desktop. Note that you should be using the document's name not the fullname, which includes the path. Where the document has not been saved, the PDF will be saved as Documentn.pdf
Code:
Sub Print1()
'
' Silent Save_to_PDF Macro
Dim strPath As String
Dim strName As String
    strPath = Environ("USERPROFILE") & "\Desktop\"
    strName = Replace(ActiveDocument.Name, ".docx", ".pdf")
    ActiveDocument.ExportAsFixedFormat _
            OutputFileName:=strPath & strName, _
            ExportFormat:=wdExportFormatPDF, _
            OpenAfterExport:=False, _
            OptimizeFor:=wdExportOptimizeForPrint, _
            Range:=wdExportAllDocument, _
            Item:=wdExportDocumentContent, _
            IncludeDocProps:=False, _
            KeepIRM:=True, _
            CreateBookmarks:=wdExportCreateNoBookmarks, _
            DocStructureTags:=True, _
            BitmapMissingFonts:=True, _
            UseISO19005_1:=False
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote