I'm having a problem with a particular script on using the datatable.exportsheet method.
I have an action that will loop through several hundred times and the last step is to write the runtime datatable and results I'm posting to it to an external excel file. This works fine in other scripts but for some reason this one script is giving me problems, and I've even recreated it.
It seems that when it exports QTP will not close the connection, as it seems to export it the first time through, but after it can't and I get the general export error message. when I try to go open the file it is corrupt, and when trying to delete I can't cause it's in use by another program, but when I close QTP I can then remove the file. I'm using QTP 10, has anyone else seen this before and resolved it?
My export Code:
DataTable.ExportSheet "\\HND-QTP-PR01\D$\Point QTP\Test Results\QA-"&vState&"-DeductibleCheck-"&vDate&".xls", "DedCheck"
Issue: Exporting runtime datasheet to localpath.(Export error no:"-214746725 9")
During runtime, when we try to export the datasheet to local folder we get a general runtime error. So every time we have to kill the QTP and its process tree to proceed.
Solution: Whenever we get ‘General Run Error’ while exporting, clean up the excel sheets as mentioned below and proceed with execution:
How to clean up all Excel formatting from XLS file using QuickTest Professional (QTP)
By using the following methods a new XLS file will result with lower file size once Excel formatting gets removed:
• Using QTP's user interface
1. Open QuickTest Professional and a new blank test script
2. Access the File menu, then select "Settings"
3. Go to the "Resources" tab
4. Under the "Data Table" field, select "Other location" option and click on the browse button ("...")
5. Once the "Open Data Table" dialog appears, find and select the XLS file desired to clean format and click "Open"
6. Click on "Apply" then "Ok" to close dialogs accepting changes Note: depending on the clean up done by QTP, processing time to later show data on the Data Table pane may vary depending on XLS file size and content
7. On the Data Table pane, right click and under "File" option, select "Export..."
8. Select a location/path and name to save this new version of XLS file