Good..... :) Regards, Suman Ch
On Sun, Aug 7, 2011 at 12:31 PM, Ajeet Mishra <[email protected]> wrote: > Thanks a lot suman. I tried the above and its working fine. Thanks > again.... :) > > On Aug 7, 8:51 am, suman ch <[email protected]> wrote: > > Hi Ajeet, > > > > You have written the FSO code inside the for loop. Try below code: > > > > Dim objExcel, objWkBook, objSheet > > Set obj= Createobject("Scripting.FilesystemObject") > > Set Text=Obj.createtextfile("C:\Results2.txt") > > > > Set objExcel = CreateObject("Excel. > > Application") > > Set objWkBook = objExcel.Workbooks.Open("C:\Results2.xls") > > Set objSheet = objWkBook.Sheets(1) > > For i=1 to 100 > > For j=1 to 4 > > If objsheet.cells(i,j).value="" Then > > msgbox "blank value" > > exitaction > > else > > CellValue= objsheet.cells(i,j).value > > > > Text.WriteLine CellValue > > > > End If > > Next > > Next > > Set Text=Nothing > > Set obj=Nothing > > > > Regards, > > Suman Ch > > > > > > > > > > > > > > > > On Sat, Aug 6, 2011 at 3:23 PM, Ajeet Mishra <[email protected]> > wrote: > > > Hi everyone, > > > > > I was trying to fetch all the values from Excel using FSO and writing > > > these values into notepad. I tried the below code but not getting any > > > success.. Please help... > > > > > Dim objExcel, objWkBook, objSheet > > > Set objExcel = CreateObject("Excel.Application") > > > Set objWkBook = objExcel.Workbooks.Open("C:\Results2.xls") > > > Set objSheet = objWkBook.Sheets(1) > > > For i=1 to 100 > > > For j=1 to 4 > > > If objsheet.cells(i,j).value="" Then > > > msgbox "blank value" > > > exitaction > > > else > > > CellValue= objsheet.cells(i,j).value > > > Set obj= Createobject("Scripting.FilesystemObject") > > > Set Text=Obj.createtextfile("C:\Results2.txt") > > > For each CellValue In objsheet.cells(i,j).value > > > Text.Write CellValue > > > Set Text=Nothing > > > Set obj=Nothing > > > Next > > > End If > > > Next > > > Next > > > > > Its reading all the cell values when I use the code without writing in > > > notepad like this: > > > > > Dim objExcel, objWkBook, objSheet > > > Set objExcel = CreateObject("Excel.Application") > > > Set objWkBook = objExcel.Workbooks.Open("C:\Results2.xls") > > > Set objSheet = objWkBook.Sheets(1) > > > For i=1 to 100 > > > For j=1 to 4 > > > If objsheet.cells(i,j).value="" Then > > > msgbox "blank value" > > > exitaction > > > else > > > CellValue= objsheet.cells(i,j).value > > > msgbox CellValue > > > End If > > > Next > > > Next > > > > > -- > > > 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
