03-15-2010 01:49 PM
I am using QTP 9.5 and MS Office 2007. My script run successfully, but in the very last line it fails. I am trying to export the results to excel using DataTable.ExportSheet "C:\QTPResults\executionInfo.xls","Global" and it fails!!!
the only message I get is that a general error occured and that is it. I tried to re.build my script and it doesn't work. Any clue?
03-16-2010 07:58 AM
It used to work for 2+ years, and all of the sudden it does not work :S
I also tried changing file extension to xlsx, but it saves the file as corrupted :S
This is the error I am getting: Runtime error: A general error occurred while exporting sheet C:\QTPResults\verifyExecutionInfo.xls to file Global
Also, one more interesting thing is that this script has calls to external actions. If I run the code without the call to these external actions, I have no problems. When adding the external actions is when I get the error.
03-16-2010 08:59 AM
Did you try running this on a totally new file ?
03-16-2010 09:18 AM
Could it be some failure in QTP? Are there any chances that if I uninstall and re-install it gets corrected?
03-16-2010 10:42 AM
04-06-2010 02:05 AM
I am also facing the same issue from past 2 weeks, tried re-installing QTP but it was of no use.
Was this issue resolved for you?
04-06-2010 06:35 AM
I created some recovery scenarios that get fired every time a general error occurs in QTP. In the recovery scenario, I have the instruction
Same thing as we with the current code. Some times it works, and some others it doesn't :S
It is VERY weird
04-06-2010 09:06 AM
04-06-2010 09:24 PM
bcoz of this I am facing another problem;
QTP hangs if execution is terminated.
If the qtp is in execution mode and user stops the execution. Then next time user is not able to execute. The following error is displayed - "Unable to create the specified run results folder. The folder may be in use by another program. Close other program that are using this folder." The troubleshooting steps taken:
1. Even after disk clean up the problem exists.
2. We tried deleting the temp results folder but we were not able to delete file 'Default.xls'.
So every time I had to kill the QTP and its process tree to proceed.
04-07-2010 08:24 AM
I don't have any exportsheet statements previous to this one, this is the only one in the whole script.
There is something that I've been doing as a workaround, which is obviously not a solution, but it helps saving a 120 rows file, with several lines of comments in each row. This workaround consists on:
1. I add a breakpoint in the line where the excel should be exported.
2. Click F11 to get that line of code executed.
3. I go to the folder where the file should be exported. If it was created, the I resume execution. If it doesn't, then I continue debugging step by step.
4. Right after the export statement, I have the error handling for the script. If it enters the error handling, it means that the export failed.
5. What I do, is to do several actions with the runtime data table until it appeaers like it is frozen and not responding.
6. Then, I have the same export statement within the error handling statements. It gets executed and it works!!!!!
See code below
If Err.Number <> 0 Then
Reporter.ReportEvent micWarning, "InitAction", "Runtime error: " & Err.Description
InitAction = False
In summary, I am thinking it is something related to the data table, but can't get to what it is.
Suman, the same exact behavior happens to me every now and then when it fails :(
04-11-2010 10:52 PM
You need to first download the excel attachment from QC to local path. Then work on the sheet using excel objects. I am still working on it.
' Some sample codes on excel objects
Set workBooks = excelObj.Workbooks.Open("C:\IMPORT\abc.xls")
Set workSheets = excelObj.worksheets("abc")
For Each c In workSheets.Range("A1:Z1").Cells
If c.Value = "XXX" Then
intCol = c.Column
workSheets.Cells(intRow,intCol).value = "Y"
03-11-2012 11:12 PM
Sorry for replying to an old thread. but now, I am facing this exact issue.
ExportSheet used to work earlier several times, Now, all of a sudden, without any code change, this statement is failing with the same General error as mentioned.
Did anyone managed to get a fix for this problem. If yes, can you please share the fix for it.