none
Save As PDF document in Word...

    Question

  • I have a great script that will break up a merged document and save all my letters off as single documents.  I need to save my documents as PDF files though rather than .doc files.  I have both Full Adobe (an older version) and PrimoPDF.  When I run the following code I don't see .pdf as an option.

        Dim conv As FileConverter
        For Each conv In FileConverters
            MsgBox conv.FormatName + " " + conv.Extensions
        Next conv

    I am not sure how to activate pdf as a FileConverter.  Suggestions?
    Monday, July 13, 2009 8:06 PM

Answers

  • I have found part of the solution.  I have downloaded the converter that allows you to SaveAs PDF from Microsoft. 
    http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=4d951911-3e7e-4ae6-b059-a2e79ed87041

    Now, PDF is an option when I "saveAs".  I cannot seem to find the syntax though to do the coded SaveAs. 

    I am trying something like the following:     ActiveDocument.SaveAs FileName:=Doc.Path & "\" & sValue & ".pdf", FileFormat:="PDF"

    I am getting a Run-time error '13': Type mismatch.  I know that I am specifying the FileFormat wrong.  I cannot find the syntax though. 

    Suggestions?
    • Marked as answer by cboshdave Tuesday, July 14, 2009 10:43 PM
    Monday, July 13, 2009 10:37 PM
  • Finally got it.  I ended up just recording a macro and modifying the code slightly to fit my needs!  I guess it shouldn't have been this hard.  Oh well...live and learn - Crash and burn!

            ActiveDocument.ExportAsFixedFormat OutputFileName:= _

            Doc.Path & "\" & sValue & ".pdf", ExportFormat:= _

            wdExportFormatPDF, OpenAfterExport:=True, OptimizeFor:= _

            wdExportOptimizeForPrint, Range:=wdExportAllDocument, FROM:=1, To:=1, _

            Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _

            CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _

            BitmapMissingFonts:=True, UseISO19005_1:=False


    • Marked as answer by cboshdave Tuesday, July 14, 2009 10:43 PM
    Tuesday, July 14, 2009 10:42 PM

All replies

  • I have found part of the solution.  I have downloaded the converter that allows you to SaveAs PDF from Microsoft. 
    http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=4d951911-3e7e-4ae6-b059-a2e79ed87041

    Now, PDF is an option when I "saveAs".  I cannot seem to find the syntax though to do the coded SaveAs. 

    I am trying something like the following:     ActiveDocument.SaveAs FileName:=Doc.Path & "\" & sValue & ".pdf", FileFormat:="PDF"

    I am getting a Run-time error '13': Type mismatch.  I know that I am specifying the FileFormat wrong.  I cannot find the syntax though. 

    Suggestions?
    • Marked as answer by cboshdave Tuesday, July 14, 2009 10:43 PM
    Monday, July 13, 2009 10:37 PM
  • Finally got it.  I ended up just recording a macro and modifying the code slightly to fit my needs!  I guess it shouldn't have been this hard.  Oh well...live and learn - Crash and burn!

            ActiveDocument.ExportAsFixedFormat OutputFileName:= _

            Doc.Path & "\" & sValue & ".pdf", ExportFormat:= _

            wdExportFormatPDF, OpenAfterExport:=True, OptimizeFor:= _

            wdExportOptimizeForPrint, Range:=wdExportAllDocument, FROM:=1, To:=1, _

            Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _

            CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _

            BitmapMissingFonts:=True, UseISO19005_1:=False


    • Marked as answer by cboshdave Tuesday, July 14, 2009 10:43 PM
    Tuesday, July 14, 2009 10:42 PM