Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can we save an exported Excel sheet directly from QTP?
#1
Hi There,

I stored some values to Data table and exported them to an Excel sheet using following script
datatable.ExportSheet "C:\book.xls", "MySheet"

Now can it possible save the file book.xls in C drive... directly from QTP. If so can you please advice?

Thanks,
Reply
#2
You can write those values directly in Excel and Save it where you want by using QTP.

Code:
Set ObjExcel = CreateObject("Excel.Application") ObjExcel.Visible = TRUE Set sWorkbook = ObjExcel.Workbooks.Add Set sWorksheet = sWorkbook.Worksheets("sheet1") sWorkbook.Worksheets("sheet1").Cells(1,1).Value = "User Name" sWorkbook.Worksheets("sheet1").Cells(1,2).Value = "Password" sWorkbook.SaveAs "C:/Book.xls" Set sWorksheet = Nothing set sWorkbook = Nothing set ObjExcel = Nothing
Reply
#3
Thanks for the solution.

Now i can save the excel file by your method of creating an excel obj.
I am also assuming that there is no way we can save the excel file from qtp when we export data from DT to Excel. If I am wrong please correct it.

Thanks,
Akhila
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to create List box in excel sheet at Run time with values yes No JACKSPARROW 0 2,149 01-17-2017, 11:05 AM
Last Post: JACKSPARROW
  Not able to click the save button in Save As window while downloading from SAP kathirvelnagaraj 0 2,854 08-25-2015, 07:37 PM
Last Post: kathirvelnagaraj
  Custom sort -Excel Sheet kiran 1 4,443 01-28-2014, 09:23 AM
Last Post: supputuri
  Save File1.xls as Text File1.txt with save as type - Text(Tab Delimited) Rupesh Singh 0 2,823 03-13-2013, 09:54 AM
Last Post: Rupesh Singh
Exclamation QTP Not accepting method directly dlaureano 0 1,827 02-06-2013, 10:01 PM
Last Post: dlaureano

Forum Jump:


Users browsing this thread: 1 Guest(s)