Re: Writing data in data table on each row


I am script however it takes more than 30 minutes to complete which will be error-prone for object recognisation in IE, chrome etc.

In order to break down to several script, I need to write the parameter to data table e.g. first script is to create account, then I would like to write the account number created on the data table. 

Then next script will use the account no. from same datatable to do enquiry and other transaction.

Is there a way how script can writ data to data table?


  • Verified Answer

    Hi there.

    If this is only 1 parameter to be saved, have it saved to an ENVIRONMENT variable.
    Check it out ->   File, Settings, Environment, user_defined. This will be valid in all your solution.

    Next you can use Excel.Application objects.
    Public Function  Save_to_Datatable(byval sTable, byval iRow,   val_to_save)

        Dim arrCols,oApp,i

        Set oApp = CreateObject("Excel.Application")
        oApp.WorkBooks.Open sTable

        'put value in table
         oApp.Cells(iRow 1, i 1).value = val_to_save
        Set oApp = Nothing



    You can use the 
    Datatable.export   OR  Datatable.ExportSheet
    to save values to your runtime Excel sheet.

    Check these out...

    Have fun!


  • hi

    Thank you the suggestion.

    I tried in this way:

    DataTable.Value("gVisit","Global") = gVisit


    where it is the data table i used.

    I expect to get the gVisit on row 5 however it always goes to row 1.

    I did try datatable.setcurrentRow(i) but no use.

    Please kindly advise.




  • This may be overlooked but...

    Make sure you are using the  'setcurrentrow'  method BEFORE the set value command and before the save process.

    Something like this:

    iRow = iRow   1
    DataTable.Value("STATUS", sSheet) = "N"
    DataTable.Value("TIME_STAMP", sSheet) = Now()

    DataTable.ExportSheet sFile , sSheet


    Give this a go...