Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating column names in an Excel ss
#1
After creating a blank spreadsheet in Excel, how do I add column names?

thx for looking
Reply
#2
Are you trying to write run time results in the spreadsheet? Maybe you can explain a bit about what you are doing.
Reply
#3
i am taking object Link names and a few other values and copying them to a spreadsheet to use in another test.

I need the column name for future testing.

This did not work ror QTP 9.5

excelSheet.Cells(1,1).Value = "Row"
Reply
#4
I tried objExcel, and this did not work. Getting error message:

Object required: 'objExcel'

Line (98): "objExcel.Cells(1,1).Value = "Row"".

objExcel.Cells(1,1).Value = "Row"
Reply
#5
The error you are getting is because the object is not defined. please define the excel object first. Refer to below code :

Code:
Filename="<your path>" Dim objExcel Set objExcel = createobject("Excel.application") objExcel.DisplayAlerts = False Set oBook = objExcel.Workbooks.Open(Filename) Set oSheet = objExcel.Activesheet objExcel.Cells(1,1).Value = "Row" oBook.SaveAs (Filename) objExcel.Workbooks.Close() Set oSheet=Nothing Set oBook=Nothing Set objExcel=Nothing

Regards,
Parminder
Reply
#6
Parminder

Thx Parminder. I just realized I was setting one obj as objTbl another as objExcel. Thx for helping me zsee my mistakes and providing me code that works ;-)

Reply
#7
Another way could be:

Create Parameters in the run-time datatables within QTP and save values for different columns for each iteration in those different parameters. This will be helpful if you are running multiple iteration of that action and capturing links and other details.

Once all the iterations are complete, you can export the run-time datatable to your machine or any shared repository. When you export the datatable, it will contain the Parameter names as the columns. You should be able to use this newly created excel file for your next test or for future. I hope you understand what I am trying to say and I am sorry if I confused you.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  UFT issues with Outsystems dynamically generated Id/names jherron 2 2,077 03-02-2020, 09:33 PM
Last Post: Swishy70
  [UFT] Get column name from SfwObject felino 0 3,434 12-02-2015, 04:07 PM
Last Post: felino
  Comparing two excel Sheets whose columns names vary Divya Roopa 2 9,463 03-26-2014, 07:20 PM
Last Post: Parke
  Creating Random String SomeIntern 0 5,584 08-21-2013, 09:10 PM
Last Post: SomeIntern
  Unable to right click column header sudhirzpatil 4 7,156 07-18-2013, 09:42 PM
Last Post: sudhirzpatil

Forum Jump:


Users browsing this thread: 1 Guest(s)