You need to work with Excel via COM. To obtain its COM object (Excel.Application), you can use the Sys.OleObject property. Information on Excel's object model can be found in its built-in VBA reference.
------ Yuri TestComplete Customer Care Engineer
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
I have found this code by searching online. But this code opens an excel from a specific path, here d:\B.xlsx
set objexcel = createobject("excel.application")
Set objWorkbook = objExcel.WorkBooks.Open("d:\B.xlsx")
Set objDriverSheet = objWorkbook.Worksheets("Sheet2")
Delay 3000 ' Wait until Excel starts
objDriverSheet.cells(2,3) = 45
But in our application we dont deal with already existing excels in the system in some path.
Instead we create an excel by populating it with data from the database when user tries to open the a document by clicking in the application.
So i am trying to find out if it is possible to attach an already opened excel to this code and try to read\write data from that excel using the code.
Please let me know if this can be done.
Also we work with named ranges in excel. But i am not able to modify this code to work with either a named range or with range of data like A1:A10. So please send me code which would be able to read and write data from named ranges and range of data.
We are searching for an appropriate testing tool for our application.
If Test Complete satisfies our requirements, we would buy some licenses.
Please help me with my queries.
There is one more which i raised - Title : cant find the item in Object Browser. Please respond to that as well.
I believe that you would have to use SQL integrated with COM some way in your script to accomplish what you need. I haven't tried that before so I would not be able to give you the code example. See SQL section of TC for help.
And about working with Ranges on excel is possible using COM. You need to define a range object.