Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting 'Unknown runtime error'
#1
Solved: 9 Years, 6 Months, 2 Weeks ago
Hi Guys,
I'm running below script and i'm getting "Unknown runtime error" at ObjWorkSheet.Rows(StartRow).Columns(Environment("Execute")).Value.
Code:
Environment("Execute")="1"

Set ObjExcel = CreateObject("Excel.Application")
ObjExcel.Visible = True
Set NewExcelfile = ObjExcel.Workbooks.Open("c:\temp\1.xls")
Set ResultFile= NewExcelfile
Set ObjWorkSheet=ResultFile.Worksheets("Sheet2")

For i = 13 To 323
    StartRow = i
ExecuteStatus = ObjWorkSheet.Rows(StartRow).Columns(Environment("Execute")).Value
If ExecuteStatus = "Y"  Then
      Browser("ABC").Page("XYZ").WebButton("EFG").Click
Else
      msgbox "Button not visible"
End If
Next

Can some please help me out with this issue.
Reply
#2
Solved: 9 Years, 6 Months, 2 Weeks ago
I dont know why in your statement you have rows.column i.e.
Code:
ExecuteStatus = ObjWorkSheet.Rows(StartRow).Columns(Environment("Execute")).Value

Do you mind trying
Code:
ExecuteStatus = ObjWorkSheet.Cells(StartRow,Environment("Execute")).Value
Reply
#3
Solved: 9 Years, 6 Months, 2 Weeks ago
Hi I thought I replied on this

Do you mind trying :
Code:
ObjWorkSheet.Cells(StartRow,Environment("Execute")).Value
Reply
#4
Solved: 9 Years, 6 Months, 2 Weeks ago
@Anshika: I tried that code as well but didn't work. I found the what the problem was. When i'm declaring variable for Environment("Execute")="1", it needs to be 1. It was reading "1" as string and not integer. Thanks for helping.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  QTP - Webtable().GetCellData() returns unknown symbols and spaces lokesh8008 2 4,656 05-10-2013, 03:49 AM
Last Post: sria123
  Excel Find causes syntax error at runtime m336fnr 0 2,906 02-09-2011, 08:36 PM
Last Post: m336fnr

Forum Jump:


Users browsing this thread: 1 Guest(s)