Word ExportAsFixedFormat from Nav

BlackBirdBlackBird Member Posts: 52
Hi All,

I'm trying to save a Worddoc (interaction) to pdf by the use of de ExportAsFixedFormat method available in Word 2007.
I have these lines of code

wrdDoc := wrdApp.Documents.Open(FileName,ParamFalse,ParamFalse2);
OutPutFileName := '"C:\Word2PdfTest.pdf"';
wdExportFormatPDF := 1; //pdf format;
wrdApp.ActiveDocument.ExportAsFixedFormat(OutPutFileName,1);

When executing i get the following error:

Microsoft Dynamics NAV
This message is for C/AL programmers:

An exception was raised in method ExportAsFixedFormat. The OLE control or Automation server has returned error (HRESULT) -2147352567.
The component did not provide the exception description.

OK

I've tried almost everything but without succes. When i manually save the Worddoc as pdf, it works fine. I recorded a macro when saving to pdf and transformed the vb-code to cal using all parameters, but everytime the same error as above.
Can anyone please help?

Thanx

Comments

  • BlackBirdBlackBird Member Posts: 52
    please... :cry: ... anyone
  • SPost29SPost29 Member Posts: 148
    this may help

    from Object Browser in Word 2007

    Const wdExportFormatPDF = 17 (&H11)
    Member of Word.WdExportFormat


    wdExportFormatPDF := 17; //pdf format;
    wrdApp.ActiveDocument.ExportAsFixedFormat(OutPutFileName,wdExportFormatPDF);

    Steve
  • BlackBirdBlackBird Member Posts: 52
    Thanks Steve,

    That solved it.
    I was convinced the exporttype was 1. Completely missed that.

    ](*,)
Sign In or Register to comment.