Word export to PDF

I can export to PDF from Word just fine with:

Var WordApp As WordApplication
Var CurrentDoc As WordDocument


WordApp = New WordApplication
WordApp.Visible = false



WordApp.Documents.Open(FileName)
'CurrentDoc = WordApp.ActiveDocument
WordApp.ActiveDocument.ExportAsFixedFormat(NewFileName,17)


Exception err As OleException
  MessageDialog.Show(err.Message)

17 = PDF format. But I need to create PDF/A (archive) type PDF’s. In VBA there is this flag UseISO19005_1 which I need. But I can’t get it to work from Xojo.

ActiveDocument.ExportAsFixedFormat OutputFileName:= _
        "MyNewPDF.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:=True

WordApp.ActiveDocument.ExportAsFixedFormat(NewFileName,17, , , , , , , , , , , , True) gives a syntax error, with or without parenthesis.

I’ve not used OLE with Word in Xojo and as I don’t have word installed I can’t check for you, but at a guess you’d have to use OLEParameter, the documentation of which is pretty thin.

@Joost_Rongen1 or @William_Yu Might be able to point you in the right direction.

Hi Julian, I already found the OLEParameter and it compiles just fine but I am unable to get positive results. Thanks anyway.

Found it. You can use OleParameter.Position to place the parm into the exact spot.

1 Like
Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.