Micro Focus QTP (UFT) Forums
Getting 'Unknown runtime error' - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Getting 'Unknown runtime error' (/Thread-Getting-Unknown-runtime-error)



Getting 'Unknown runtime error' - UFT_Newbie - 09-04-2014

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.


RE: Getting 'Unknown runtime error' - anshika.agarwal - 09-08-2014

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



RE: Getting 'Unknown runtime error' - anshika.agarwal - 09-08-2014

Hi I thought I replied on this

Do you mind trying :
Code:
ObjWorkSheet.Cells(StartRow,Environment("Execute")).Value



RE: Getting 'Unknown runtime error' - UFT_Newbie - 09-08-2014

@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.