Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Export to Excel Error with file being open
#1
Solved: 11 Years, 3 Months, 3 Weeks ago
I have a test I am running that exports data to Excel. The first time I run the test it creates the file no problem but then when it loops through for the second time it hits this code and errors out saying The DataTable.Export (file) operation failed.
Cannot open the D:\CDC-Automation\Data\Iteration1\Build5_7\Target\Target_Scan_URL.xls file because it is already open in another application.

Function file: D:\CDC-Automation\CDC_QTP_MAIN\Function Libraries\CDC_functions.qfl
Line (694): " datatable.export Target_file".

If instr(url_location,"Source") <> 0 then Source_file=file_dir & "Source_Scan_" & file_name
datatable.export Source_file
elseif instr(url_location,"Target")<> 0 then]
Target_file =file_dir & "Target_Scan_" & file_name Source_file=Replace(Target_file, "Target", "Source") datatable.export Target_file
end if

Any suggestions?
Reply
#2
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi,

In 2nd run error msg is coming,do u want to overwrite the sheet or append it?

Regards,
Sankalp
Reply
#3
Solved: 11 Years, 3 Months, 3 Weeks ago
This is a known issue... There is a workaround for this provided by HP.

Please check the below site.

http://automatingsap.blogspot.in/2012/07...mport.html

Regards,
Ankesh
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Can we open a password protected zip file using QTP? arunarora1990 2 4,819 07-03-2011, 09:46 AM
Last Post: rajpes

Forum Jump:


Users browsing this thread: 1 Guest(s)