Author | Topic: Fatal when exporting to Excel | |
---|---|---|
Peter Alderliesten | Fatal when exporting to Excel on Mon, 11 Oct 2010 16:00:49 +0200 Hi, I have a problem on a few machines when exporting data to a new Excel workbook. The routine works perfectly on my Win7 machine and my WinXP machine, but I got a problem report from two machines in the field (one using Win7 and the other WinXP). In the application I create an array (for this test with character data only), create a workbook, fill it with the data from that array, save the workbook, close and quit. On the offending machines the application runs into a fatal after. I cannot see at which point it is. There is a valid Excel file created with the exported data. The application itself freezes. This is the code that I am running: oFile := createObject("Excel.Application") oFile:application:displayAlerts := .f. oDoc := oFile:application:workbooks:add() oRange := oDoc:activeSheet:range(excelRange("A1", len(aList[1]), len(aList))) oRange:value := aList oRange:columns:autofit() oDoc:saveAs(cFile, xlWorkbookNormal) oDoc:close() oFile:quit() oFile:destroy() The error log is attached. I would appreciate any comments on solving this problem. Thanks, Peter XPPFATAL.LOG | |
Jorge L | Re: Fatal when exporting to Excel on Mon, 11 Oct 2010 13:45:19 -0300 Hi ,which version of excel you have in that machine ? "Peter Alderliesten" escribió en el mensaje de noticias:10qojwqqagvbz.foj640kihhyf.dlg@40tude.net... Hi, I have a problem on a few machines when exporting data to a new Excel workbook. The routine works perfectly on my Win7 machine and my WinXP machine, but I got a problem report from two machines in the field (one using Win7 and the other WinXP). In the application I create an array (for this test with character data only), create a workbook, fill it with the data from that array, save the workbook, close and quit. On the offending machines the application runs into a fatal after. I cannot see at which point it is. There is a valid Excel file created with the exported data. The application itself freezes. This is the code that I am running: oFile := createObject("Excel.Application") oFile:application:displayAlerts := .f. oDoc := oFile:application:workbooks:add() oRange := oDoc:activeSheet:range(excelRange("A1", len(aList[1]), len(aList))) oRange:value := aList oRange:columns:autofit() oDoc:saveAs(cFile, xlWorkbookNormal) oDoc:close() oFile:quit() oFile:destroy() The error log is attached. I would appreciate any comments on solving this problem. Thanks, Peter | |
Peter Alderliesten | Re: Fatal when exporting to Excel on Mon, 11 Oct 2010 19:20:50 +0200 Jorge, > Hi ,which version of excel you have in that machine ? One machine has Office 2007 and the other Office 2010 Peter > Hi, > > I have a problem on a few machines when exporting data to a new Excel > workbook. The routine works perfectly on my Win7 machine and my WinXP > machine, but I got a problem report from two machines in the field (one > using Win7 and the other WinXP). > > In the application I create an array (for this test with character data > only), create a workbook, fill it with the data from that array, save the > workbook, close and quit. > > On the offending machines the application runs into a fatal after. I cannot > see at which point it is. There is a valid Excel file created with the > exported data. The application itself freezes. > > This is the code that I am running: > oFile := createObject("Excel.Application") > oFile:application:displayAlerts := .f. > oDoc := oFile:application:workbooks:add() > oRange := oDoc:activeSheet:range(excelRange("A1", len(aList[1]), > len(aList))) > oRange:value := aList > oRange:columns:autofit() > oDoc:saveAs(cFile, xlWorkbookNormal) > oDoc:close() > oFile:quit() > oFile:destroy() > > The error log is attached. > > I would appreciate any comments on solving this problem. > > Thanks, > Peter | |
Jorge L | Re: Fatal when exporting to Excel on Mon, 11 Oct 2010 21:28:03 -0300 peter, to use activex with excel 2010, you must define the block of the files in the confidence center (in options) "Peter Alderliesten" escribió en el mensaje de noticias:vv11wxlfvufs.t9euke0hs1v8.dlg@40tude.net... Jorge, > Hi ,which version of excel you have in that machine ? One machine has Office 2007 and the other Office 2010 Peter > Hi, > > I have a problem on a few machines when exporting data to a new Excel > workbook. The routine works perfectly on my Win7 machine and my WinXP > machine, but I got a problem report from two machines in the field (one > using Win7 and the other WinXP). > > In the application I create an array (for this test with character data > only), create a workbook, fill it with the data from that array, save the > workbook, close and quit. > > On the offending machines the application runs into a fatal after. I > cannot > see at which point it is. There is a valid Excel file created with the > exported data. The application itself freezes. > > This is the code that I am running: > oFile := createObject("Excel.Application") > oFile:application:displayAlerts := .f. > oDoc := oFile:application:workbooks:add() > oRange := oDoc:activeSheet:range(excelRange("A1", len(aList[1]), > len(aList))) > oRange:value := aList > oRange:columns:autofit() > oDoc:saveAs(cFile, xlWorkbookNormal) > oDoc:close() > oFile:quit() > oFile:destroy() > > The error log is attached. > > I would appreciate any comments on solving this problem. > > Thanks, > Peter | |
Andreas Gehrs-Pahl | Re: Fatal when exporting to Excel on Mon, 11 Oct 2010 18:20:43 -0400 Peter, >I have a problem on a few machines when exporting data to a new Excel >workbook. The routine works perfectly on my Win7 machine and my WinXP >machine, but I got a problem report from two machines in the field (one >using Win7 and the other WinXP). Your XppFatal error log indicates that the (IDSC) error occurred in thread number four (with ID 1084) in line 485 of the "HandleToolTip" method of your "SVIDialog" class. I'm afraid, there is no indication in that log file, that points to Excel or the actual reason for the IDSC. But because of the nature of IDSC errors, the cause might be somewhere completely different in your program, and it just took some time until the effect manifested itself. Have you run your program in the debugger? Could it be that the user messed around with Excel -- like closing it manually -- before the application could close it? Do you always get (the same) XppFatal log file(s) or just sometimes? Was this Thread doing the Excel export or was it one of the other threads? I would suggest to put sequences around some of the code and do some error checking, to make sure that oFile, oDoc and oRange are valid objects throughout the process, before calling any of their methods. Besides that, as you are dealing with another application (MS Excel), you might not have many other choices to prevent those IDSCs. Andreas Andreas Gehrs-Pahl Absolute Software, LLC phone: (989) 723-9927 email: Andreas.GP@Charter.net Andreas_Gehrs-Pahl@EJusticeSolutions.com Andreas@DDPSoftware.com web: http://www.Aerospace-History.net | |
Peter Alderliesten | Re: Fatal when exporting to Excel on Tue, 12 Oct 2010 14:42:26 +0200 Andreas, >>I have a problem on a few machines when exporting data to a new Excel >>workbook. The routine works perfectly on my Win7 machine and my WinXP >>machine, but I got a problem report from two machines in the field (one >>using Win7 and the other WinXP). > > Your XppFatal error log indicates that the (IDSC) error occurred in > thread number four (with ID 1084) in line 485 of the "HandleToolTip" > method of your "SVIDialog" class. I'm afraid, there is no indication > in that log file, that points to Excel or the actual reason for the > IDSC. But because of the nature of IDSC errors, the cause might be > somewhere completely different in your program, and it just took some > time until the effect manifested itself. > Have you run your program in the debugger? Could it be that the user > messed around with Excel -- like closing it manually -- before the > application could close it? Do you always get (the same) XppFatal log > file(s) or just sometimes? Was this Thread doing the Excel export or > was it one of the other threads? I had a look at the XppFatal.log (the error is reproduceable) and I noticed two things: - the error is sometimes in thread 4, sometimes in thread 5 (which I assume is created by Xbase++ for the connection with Excel, I did not create it). - if the error occurs in thread 4 then it is always in a routine called from the event loop, but there's no saying which routine/linenumber it will be. If I take out the few Excel lines, the application runs flawlessly. With the Excel lines it runs fine on my machine(s), but it stops the application with the first export to Excel on the other machine (sometimes it happens immediately, sometimes I have to move the mouse around). In the debugger there's nothing to see. The application quits, without passing the error handler (mine or Alaska's). > I would suggest to put sequences around some of the code and do some > error checking, to make sure that oFile, oDoc and oRange are valid > objects throughout the process, before calling any of their methods. > Besides that, as you are dealing with another application (MS Excel), > you might not have many other choices to prevent those IDSCs. Thanks, I will have to do some further testing. Peter |