Consulting

Results 1 to 2 of 2

Thread: Saving as PDF and Opening document for viewing in one step

  1. #1

    Saving as PDF and Opening document for viewing in one step

    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!

  2. #2
    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
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •