I wasn't able to find out any information on what format the parameters are required to look like when passed along with the Method ExportAsFixedFormat.
I'm currently using the following code to change the active printer followed by the printout command
(vlax-put-property XL "ActivePrinter" "DocuCom PDF Driver on Ne03:") (vlax-invoke-method XLS "Printout")
where XL is my spreadsheet and XLS is the active worksheet. This works but the printer controls filename and location.
(vlax-invoke-method XLS "ExportAsFixedFormat"
I've found the ExportAsFixedFormat but can not find any documentation that shows how to format the parameters within LISP to send to Excel.
The object browser for VBA in Excel shows the following:
Sub ExportAsFixedFormat(Type As XlFixedFormatType, [Filename], [Quality], [IncludeDocProperties], [IgnorePrintAreas], [From], [To], [OpenAfterPublish], [FixedFormatExtClassPtr]) Member of Excel.Chart
I recording a macro and got the following that shows some additional information.
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _ "C:\test.pdf" _ , Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _ :=False, OpenAfterPublish:=True
Is there any documention showing what this looks like when using the vlax-invoke-method?
Solved! Go to Solution.
Solved by jshimkus. Go to Solution.
Try:
(vlax-invoke-method XLS 'ExportAsFixedFormat)
???
I've never worked with Excel methods.. but the method is in 'symbol format not "string" in VisualLisp
EDIT:
You've seen this right?
http://docs.autodesk.com/ACD/2011/ENU/filesALR/WS1a9193826455f5ff1a32d8d10ebc6b7ccc-6816.htm
EDIT #2:
Apparently, I didn't read it closely enough.. it says, "A symbol or string naming the method to be called." My mistake.. I'd only ever seen symbols used.
Enumerated constant values are typically assigned integer equivalents; the Excel VBA object model documentation should indicate what these values are (inspection of values at run-time is another option).
Optional arguments in methods called from (vlax-invoke-method...) must all be filled out with either a defintitive value or nil. This can get a little rediculous in LISP - I've had function calls with signatures like (vlax-invoke-method app_obj 'MethodName new_value nil nil nil nil nil nil nil nil nil nil...).
Found the answer after re-reading dgorsman post!!!
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"))
Not sure about the Optional Parameters needing values?!?!? The ExportAsFixedFormat works with just one optional parameter (The filename) and the Printout had none even though the object browser shows 9. I'm using Excel 2010 so I don't know if that matters.