Author Topic: Using ExportAsFi​xedFormat from Excel 2010 from Lisp  (Read 2472 times)

0 Members and 1 Guest are viewing this topic.

commodore

  • Newt
  • Posts: 51
Using ExportAsFi​xedFormat from Excel 2010 from Lisp
« on: August 18, 2011, 02:53:40 PM »
Code: [Select]
;;; XL is the Excel Spreadsheet
;;; XLS is the Excel worksheet
(vlax-put-property XL "ActivePrinter" "DocuCom PDF Driver on Ne03:")  
(vlax-invoke-method XLS "Printout")

I'm using the above code to change the printer then print out an excel page.

I would rather use:

Code: [Select]
(vlax-invoke-method XLS "ExportAsFixedFormat")
This way I would have control of where it gets saved along with not having to deal with the fact that the end user might not have the .pdf driver.
Of course, with the above line I do not have all of the necessary parameters.  When I inspect the line it tells me that.

Looking at the object browser in Excel I can find the following information on ExportAsFixedFormat:

Code: [Select]
Sub ExportAsFixedFormat(Type As XlFixedFormatType, [Filename], [Quality],
[IncludeDocProperties], [IgnorePrintAreas], [From], [To], [OpenAfterPublish],
[FixedFormatExtClassPtr]) Member of Excel.Worksheet

This is where I am having issues.  I need the XlFixedFormatType (which I've found out to be xlTypePDF) but can not figure out how to format the line in LISP to accept it.  I've tried different variations such as:
Code: [Select]
(vlax-invoke-method XLS "ExportAsFixedFormat" "xlTypePDF")
(vlax-invoke-method XLS "ExportAsFixedFormat" xlTypePDF)
(vlax-invoke-method XLS "ExportAsFixedFormat" "XlFixedFormatType.xlTypePDF")

Any help or documentation would be greatly appreciated

commodore

  • Newt
  • Posts: 51
Re: Using ExportAsFi​xedFormat from Excel 2010 from Lisp
« Reply #1 on: August 23, 2011, 08:17:08 AM »
Found the answer after re-reading a post on the autodesk forum from dgorsman!!!

After looking at the object browser in Excel for ExportAsFixedFormat  ... again ...
The 'XlFixedFormatType' took me to a section showing the members of XlFixedFormatType

xlTypePDF is set to 0
xlTypeXPS is set to 1

;;; This line will create a test.pdf file located on the c-drive
(vlax-invoke-method XLS "ExportAsFixedFormat" 0 "c://test"))
;;; This line will create a test.xps file located on the c-drive
(vlax-invoke-method XLS "ExportAsFixedFormat" 1 "c://test"))