Don't call xcelObject.Workbooks.Close it will stay open. Keep global reference to xcelObject
There is also UsedRange http://msdn.microsoft.com/en-us/library/microsoft.office.tools.excel.worksheet.usedrange(v=vs.80).aspx On Thu, Jul 14, 2011 at 3: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
