Hi All, Thanks for your replay but I am not even able to open it,it is throwing error of excel object,not accepting it. Therefore not even able to proceed for further coding for excel.
But when i try to open it manually and try to edit something in its cell, it is performing this action. Thanks, Nidhi On Sat, Jan 24, 2015 at 11:18 PM, Maheh Khanna <[email protected]> wrote: > Hellow Nidhi, > > You have not created any object for sheet like you create for Excel and > work books... > Here a sample code to write the data in to excel > > Set myxl = createobject("excel.application") > 'Make sure that you have created an excel file before exeuting the > script.'Use the path of excel file in the below code'Also make sure that your > excel file is in Closed state before exeuting the script. > > myxl.Workbooks.Open "D:\qtp.xls" > myxl.Application.Visible = true > 'this is the name of Sheet in Excel file "qtp.xls" where data needs to > be entered set mysheet = myxl.ActiveWorkbook.Worksheets("Sheet1") > 'Enter values in Sheet1. > 'The format of entering values in Excel is excelSheet.Cells(row,column)=value > mysheet.cells(1,1).value ="Name" > > > > > On Thursday, January 22, 2015 at 6:15:33 PM UTC+5:30, nids wrote: >> >> Hi, >> >> I got stuck to 1 problem,please help me to solve this. >> >> If I try to open an excelsheet using VB script code ,I am unable to open >> it. >> Below is the code. >> >> Set objExcel = CreateObject("Excel.Application") >> Set objWorkbook = objExcel.Workbooks.Open("C:\Test\Book1.xls") >> >> objExcel.Application.Visible = True >> objExcel.Workbooks.Add >> objExcel.Cells(1, 1).Value = "Test value" >> >> objExcel.ActiveWorkbook.Save "C:\Test\Book1.xls" >> objExcel.ActiveWorkbook.Close >> >> objExcel.Application.Quit >> >> But when I try to open it manually I am able to open it and also able to >> save the text in the workbook cell which I am unable to do currently,not >> even able to put any value in workbook cell. >> >> Thanks, >> Nidhi Sharma >> > -- > -- > 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 Groups > "QTP - HP Quick Test Professional - Automated Software Testing" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- -- 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 Groups "QTP - HP Quick Test Professional - Automated Software Testing" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
