Thanks buddy, I checked my loops and I got the problem. Thanks again for your help.
Really Appreciated :) On Monday, 3 September 2012 15:24:59 UTC+5:30, ras2011 wrote: > > Script Out of range error means your are trying to get data from some > place that does not occur. Double Check your for loops - i - if your > exceeding the actual lines in your excel etc columns > > 2012/9/3, Amit Raj <[email protected] <javascript:>>: > > Hi, > > > > I am trying to read an excel file with below function and I am getting > > "Script Out of range" error message, However when I tried the same code > on > > a friends machine it worked fine. > > > > Can anybody in this group figure out the issue, that would be a great > help. > > > > '''''''''''''''excel read function'''''''''''''''''''''''''''' > > Function xlread(xlpath,xlsheet,xlr,xlc) > > Dim myxlapp,myxlsheet > > Set myxlapp=createobject("Excel.Application") > > myxlapp.Workbooks.Open xlpath > > Set myxlsheet=myxlapp.ActiveWorkbook.Worksheets(xlsheet) > > xlread=myxlsheet.cells(xlr,xlc) > > print xlread > > myxlapp.ActiveWorkbook.Close > > myxlapp.Quit > > Set myxlsheet=nothing > > Set myxlapp=nothing > > End Function > > ************************************************** > > > > On Friday, 20 March 2009 00:18:30 UTC+5:30, [email protected] wrote: > >> > >> Hi > >> > >> I have a scenario like the one mentioned below. > >> > >> 1. I have a dynamic array say textlines() > >> 2. I am reading a txt file content, line by line and need to store it > in > >> the above mentioned dynamic array > >> 3. i need to calculate the total number of lines in the file > >> > >> To accomplish this i have coded like this, but which doesnt work??!!!! > >> > >> > >> Dim tempfile, textlines(),i,fso > >> > >> Const ForReading = "1" > >> > >> i = 0 > >> > >> Set fso = CreateObject("Scripting.FileSystemObject") > >> Set tempfile= fso.OpenTextFile( "C:\file.txt", ForReading ) > >> > >> Do Until tempfile.AtEndofStream > >> textlines(i) = tempfile.ReadLine() > >> i = i + 1 > >> > >> Loop > >> > >> msgbox(i) > >> > >> Please help me with the solution. Also how to return two values("i" and > >> textline()), if this is to be done in a function???? > >> > >> Waiting for the reply > >> Regards > >> Suresh S > >> > > > > -- > > 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]<javascript:> > > To unsubscribe from this group, send email to > > [email protected] <javascript:> > > For more options, visit this group at > > http://groups.google.com/group/MercuryQTP?hl=en > > > > > -- > Rasim Avcı > -- 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
