Posted 29 Feb 2012
Link to this post
Another question that will doubtless be easily answered by someone who knows what they're doing.
I want my script to branch depending on the value I can retrieve from a databound Excel spreadsheet cell.
I know how to get the value from the cell using this VB in the Code Behind window, and I can set it as an extracted value available to the Test Studio script with the last line:
Dim row As Integer = 2
Dim column As Integer = 4
Dim input As String = "C:\Users\edwardni\Documents\Test Studio Projects\Base\Data\BaseData.xlsx"
Dim app As New Microsoft.Office.Interop.Excel.Application()
Dim inputBook As Microsoft.Office.Interop.Excel.Workbook = app.Workbooks.Open(input, 0, False, 3, "", "", False, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "", True, False, 0, True, False, False)
Dim inputSheet As Microsoft.Office.Interop.Excel.Worksheet = DirectCast((inputBook.Worksheets.Item("SetupAllRoles")), Microsoft.Office.Interop.Excel.Worksheet)
Dim selection As String = TryCast(DirectCast(inputSheet.Cells(row, column), Microsoft.Office.Interop.Excel.Range).Text, String)
What I want to do in the script is to have an IF... Else statement like this:
IF ($(IsAdmin) = "Y")
<do some stuff>
<do some different stuff>
But I don't know how to build the above structure in the script itself. There is nothing I need to record against so I have nothing to convert to a logical step.
All responses gratefully received,
Nigel Edwards, Transition Computing.