Kiran,

Gopi solution should be sufficient I believe but I still feels that
declaring the array in below code is not a good practice until we know the
exact number of items. I would suggest Kiran to gather the total number of
Data rows you need to add and then dynamically declare the array size equal
to the data mine size or whatever number of rows you want to enter.

If not then I would suggest to use atleast ERASE statement to De-allocate
the array memory at the end of code.


Regards
Shalabh Dixit



On Fri, Jul 15, 2011 at 12:01 PM, gopi nath <[email protected]> wrote:

> Hi,
>
> pl try this, it may help u..
>
> Note: pass your values as many in to this array
>
> val=Array(23,11,21)
> ad(val)
> Function ad(val)
>     Set exl=createobject("excel.application")
> exl.Workbooks.Open "C:\Documents and Settings\Gopi\Desktop\Book1.xls"
>
> set sht=exl.ActiveWorkbook.Worksheets(1)
> rw=sht.usedrange.rows.count
>  For i=0 to uBound(val)
> sht.Cells(rw+1+i,1)=val(i)
> Next
>  exl.ActiveWorkbook.Save
> exl.Quit
>  Set exl=Nothing
> Set sht=Nothing
> End Function
>
>
>
>
>
> On Thu, Jul 14, 2011 at 12:03 PM, Kiran Ogeti <[email protected]> wrote:
>
>> I am calling a function to add data to excel sheet as below,.. basically
>> wanting to add data as passing through arguments..
>>
>> but since its going to be numerous rows the data gets added..there are two
>> problems
>>
>> 1. Create object and closing object, on every row added
>> 2. opening and closing Excel, on every row added
>>
>> Is there anyway just keep the Excel sheet open and keep adding the rpw
>> until its done?.. thanks alot
>>
>>
>> Public function ExportResultstoExcel(datamine,RowStart,ColStart)'
>>
>>    FilePath ="C:\xxxxxxxx.xlsx"
>>    Set xcelObject = createobject("Excel.application")
>>    xcelObject.Workbooks.Open(FilePath)
>>
>>    xcelObject.Worksheets(1).Cells(RowStart,ColStart).value =datamine
>>
>> xcelObject.ActiveWorkbook.Save
>> xcelObject.Workbooks.Close
>> ,
>>
>> --
>> You received this message because you are subscribed to the Google
>> "QTP - HP Quick Test Professional - Automated Software Testing"
>> group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/MercuryQTP?hl=en
>
>
>  --
> You received this message because you are subscribed to the Google
> "QTP - HP Quick Test Professional - Automated Software Testing"
> group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/MercuryQTP?hl=en
>

-- 
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en

Reply via email to