Excel automation + PDF

stampestampe Member Posts: 48
edited 2005-04-09 in Navision Attain
I need to create an Excel file from within Navision and then I need to save this excel file as a .PDF file, in order to do this I need to execute code similar to this excel macro from Navision


" ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
"Amyuni PDF Converter on LPT1:", Collate:=True"


i have this code in Navision

"XlAppl.ActiveWindow.SelectedSheets.PrintOut"

But I dont know how to pass the parametres

Any ideas ?

Regards

Peter

Comments

  • fbfb Member Posts: 246
    C/AL uses 'positional' parameters instead of 'named' parameters. What this means is you must 'fill in all the positions' up to the last parameter you wish to supply.

    From the on-line VB Help for Excel, you can find that the 'PrintOut' method has the following signature:
    PrintOut(From, To, Copies, Preview, _
      ActivePrinter, PrintToFile, Collate, PrToFileName)
    
    The detail description of this method indicates that all of the parameters are optional. However, since you wish to supply the 'Copies', 'ActivePrinter' and 'Collate' parameters, you will have to supply values for each of the parameters up to the 'Collate' parameter.

    Try something like this:
    XlAppl.ActiveWindow.SelectedSheets.PrintOut(1, 999, 1, FALSE,
      'Amyuni PDF Converter on LPT1:', FALSE, TRUE);
    
  • stampestampe Member Posts: 48
    I tried what you suggested and it works fine

    thank you

    Regards

    Peter
Sign In or Register to comment.