using COM to talk to Excel
Hello,
I am trying to talk to Excel through the COM interface. I have encountered
the following:
(defsystem LW-XL
(:default-pathname "c:\\Program Files\\Microsoft Office\\Office10\\")
:members (("XL5EN32.OLB" :type :midl-type-library-file)))
(compile-system 'lw-xl :load t)
(com:co-initialize)
(setq xl (com:create-object :progid "Excel.Application"))
(com:call-dispatch-method (xl application active-workbook))
(com:call-dispatch-method (xl application name))
(com:call-dispatch-put-property (xl application visible) t)
(com:call-dispatch-get-property (xl application version))
(com:call-dispatch-get-property (xl page-setup creator))
(com:call-dispatch-get-property (xl workbooks creator))
(com:call-dispatch-method (xl workbooks creator))
(setq app (com:query-interface xl 'application))
(com:call-dispatch-method (app workbooks creator))
all return without error;
(com:call-com-interface (xl workbooks open) "foo.xls")
Error: COM Dispatch Error ((COM:I-DISPATCH COM:INVOKE)) : Member not found.
(com:query-interface xl 'workbooks)
Error: COM Error (COM:QUERY-INTERFACE) : No such interface supported
Questions:
is the XL5EN32.OLB the right way to set up the COM interface for LW?
I also see (in the OLEView) that there is an _Application interface, but
(query-interface xl '_application) errs - why?
how do I access the application workbooks method if not as above?
Thanks,
R