Excel automation + PDF

stampe
Member Posts: 48
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
" 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
0
Comments
-
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);
0 -
I tried what you suggested and it works fine
thank you
Regards
Peter0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions