Prev: mySQL and cftransaction
Next: cfreport
From: kruse on 6 Mar 2006 04:26 This code has worked before. But now it has stopped working: <CFTRY> <!--- If it exists, connect to it ---> <CFOBJECT ACTION="CONNECT" CLASS="Excel.Application" NAME="objExcel" TYPE="COM" > <CFCATCH> <!--- The object doesn't exist, so create it ---> <CFOBJECT ACTION="CREATE" CLASS="Excel.Application" NAME="objExcel" TYPE="COM" > </CFCATCH> </CFTRY> <CFSCRIPT> /* Open Excel in the background */ objExcel.Visible = false; /* Disable alerts such as: 'Save this document?' */ objExcel.DisplayAlerts = false; /* Define the workbooks object */ objWorkBook = objExcel.Workbooks; /* Open the Excel file */ objOpenedBook = objWorkBook.Open("#Attributes.FilePath#"); /* Create a collection of all existing worksheets */ objSheets = objOpenedBook.Sheets; /* The number of sheets in the file */ numOfSheets = objSheets.Count; </CFSCRIPT> I get this error: An exception occurred when executing a Com method. The cause of this exception was that: AutomationException: 0x80010105 - The server threw an exception.. The error occurred in D:\Applications\LDev\Tag\ReadXLS.cfm: line 85 Called from D:\Applications\LDev\Assessment.cfm: line 84 Called from D:\Applications\LDev\Assessment.cfm: line 73 Called from D:\Applications\LDev\Assessment.cfm: line 51 Called from D:\Applications\LDev\Assessment.cfm: line 1 Called from C:\CFusionMX7\CustomTags\Layout.cfm: line 351 Called from C:\CFusionMX7\CustomTags\Layout.cfm: line 1 Called from D:\Applications\LDev\Index.cfm: line 99 Called from D:\Applications\LDev\Tag\ReadXLS.cfm: line 85 Called from D:\Applications\LDev\Assessment.cfm: line 84 Called from D:\Applications\LDev\Assessment.cfm: line 73 Called from D:\Applications\LDev\Assessment.cfm: line 51 Called from D:\Applications\LDev\Assessment.cfm: line 1 Called from C:\CFusionMX7\CustomTags\Layout.cfm: line 351 Called from C:\CFusionMX7\CustomTags\Layout.cfm: line 1 Called from D:\Applications\LDev\Index.cfm: line 99 83 : objExcel.Visible = false; 84 : /* Disable alerts such as: 'Save this document?' */ 85 : objExcel.DisplayAlerts = false; 86 : /* Define the workbooks object */ 87 : objWorkBook = objExcel.Workbooks; Any one who knows what can be done to make it work??
From: Iceborer on 6 Mar 2006 11:17 Not sure that this is your answer, but there is an MS KB article that talks about this error http://support.microsoft.com/kb/912448#kb2 ...
From: ksmith on 6 Mar 2006 14:10 Hi Kruse, Some additional info would be helpful. What version of CF and what version of excel is on the machine? Does it work on a freshly started CF server or always fail? If you run taskmanager, do you see the excel application under processes? Do you see several?
From: kruse on 7 Mar 2006 01:42 Originally posted by: Iceborer Not sure that this is your answer, but there is an MS KB article that talks about this error http://support.microsoft.com/kb/912448#kb2 ... Yes I saw this article and installed office 2003 sp2. But it still doesn?t work. This sentence bothers me: We do not currently recommend or support Automation of Microsoft Office programs from any unattended, non-interactive client program or component. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
From: kruse on 7 Mar 2006 02:44
Originally posted by: ksmith Hi Kruse, Some additional info would be helpful. What version of CF and what version of excel is on the machine? Does it work on a freshly started CF server or always fail? If you run taskmanager, do you see the excel application under processes? Do you see several? Hi Ken We are using Coldfusion MX 7 (7,0,0,91690) on a windows 2003 server sp1. The Excel version is 2003 sp2 (11.6560.6568). When I run the code I see one Excel process that finishes when the code fails. And it fails with this: An exception occurred when executing a Com method. The cause of this exception was that: AutomationException: 0x80010105 - The server threw an exception.. The error occurred in D:\Applications\LDev\Tag\ReadXLS.cfm: line 85 Called from D:\Applications\LDev\Tag\PopUpUploadExcel.cfm: line 115 Called from D:\Applications\LDev\Tag\ReadXLS.cfm: line 85 Called from D:\Applications\LDev\Tag\PopUpUploadExcel.cfm: line 115 83 : objExcel.Visible = false; 84 : /* Disable alerts such as: 'Save this document?' */ 85 : objExcel.DisplayAlerts = false; 86 : /* Define the workbooks object */ 87 : objWorkBook = objExcel.Workbooks; This mean that the connection to the Excel com object does success. But I don?t understand why it fails on line 85 and not on line 83 which is the first command it executes on the object. I have tried to restart the server and then it worked!! I hope it will keep working. |