Micro Focus QTP (UFT) Forums

Full Version: How To Capture Array Value into Excel Worksheet?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,

I have been trying all various methods to get the run time value from the application to an array and then from the array to excel worksheet. Here is my script, please if you can educate me on what it is that i am doing wrong here. 

  systemutil.Run "iexplore.exe""www.edmunds.com/calculators"
Set MyBrowser = Browser("Micclass:=Browser""CreationTime:=0""Title:=.*").Page("Micclass:=Page""CreationTime:=0""Title:=.*") 

Set MyXL = CreateObject ("excel.application")
    MyXl.workbooks.open "C:\Users\User\Desktop\ArrayPracticeExcel.xlsx"
    MyXl.application.visible = True 
set MySheet = MyXl.activeworkbook.worksheets ("Sheet1") 
    
Dim oDesc
Set oDesc = Description.Create
set oDesc = Description.Create 
    oDesc("Micclass").Value = "WebEdit"
    oDesc("Name").Value = "calc_default_value"
    oDesc("html tag").Value = "INPUT"
    
    set Obj = MyBrowser.ChildObjects(oDesc)
    msgbox Obj.Count 
    

Dim i,x,Arr1()

For i = 0 To obj.count-1
    x = obj(i).GetRoProperty("html id")
        msgbox x
        ReDim preserve arr1(obj.count-1)
        arr1(i) = x 
        
Next
ReDim preserve arr1(obj.count-1)
For j = 0 To ubound(Arr1)
    mysheet.cells(i,"A").Value = arr1(j)
Next

This Line above only adds the value to the 4th row and nothing else. I wan the script to be able to capture the value and put them into row 1,2,3,and 4. Please any help would be greatly appreciated.