Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Want to Iterate!!
#1
Solved: 10 Years, 7 Months, 3 Weeks ago
Hi All,

Greetings of the day.
My Problem is , i have my application here.
So basically my module is to create a user.
So when we click on the "add user" button , it will give me around 15-20 text boxes, combo boxes and check boxes to fill out.

here is a piece of code...
-----------------------------------------------------------
Code:
set sh = CreateObject("Scripting.FileSystemObject")
set exl = CreateObject("Excel.Application")
exl.visible = true
set wb = exl.WorkBooks.Open(excel_path)
list_value = exl.ActiveSheet.Cells (2,1) .Value
Browser("Browser").Page("Add User").WebEdit("User Name").Set list_value

-----------------------------------------------------------
Now i have 20 text boxes here?
how do i , move to next text box and fill in the data from excel sheet.

Once i fill in all the values in the sheet.
How can i do the same thing [ ie adding new users ] , mulitple times?
Reply
#2
Solved: 10 Years, 7 Months, 3 Weeks ago
if I am getting it right, the excel contains the details of user and the 20 text boxes at your application need to filled up with these details.
if so follow these steps
loop through the number of data rows and data columns in your excel sheet
take the value from each row and column and assign it to the text boxes there.

if you need more help on this tell us how ur excel looks like and what are the fields to be filled.

Reply
#3
Solved: 10 Years, 7 Months, 3 Weeks ago
Hi Saket,

Thank You So much for your reply.
You are right.
Now in my application, whatever fields are present to be filled, the data for them are in the excel sheet.

------------------------------------------------------------------------------------------------------------
Code:
list_value = exl.ActiveSheet.Cells (2,1) .Value
Browser("Browser").Page("Add User").WebEdit("User Name").Set list_value
------------------------------------------------------------------------------------------------------------

Now the above , places the first field value from the excel. This works fine.
i want to move to the next field now....
basically - i have "hardecoded" the cell values. but for iterating i need to put a loop.

so,
1. I need to get row couint and colcount is it?
2. Can you please provide a pseudocode or something for me.

Thank You,
SK
Reply
#4
Solved: 10 Years, 7 Months, 3 Weeks ago
see the piece of code below
I have assumed each row in your excel contains details of one user
Code:
RowCnt = wb.Worksheets(sheetname).UsedRange.rows.Count

For nRow = 1 To RowCnt
    
        list_value = wb.Worksheets(sheetname).Cells(nRow,1).value
        Browser("Browser").Page("Add User").WebEdit("User Name").Set list_value
        list_value = wb.Worksheets(sheetname).Cells(nRow,2).value
        Browser("Browser").Page("Add User").WebEdit("User Name").Set list_value
Next
let me know how it goes.

Reply
#5
Solved: 10 Years, 7 Months, 3 Weeks ago
Yes you are right Saket. This should solve the problem..
Reply
#6
Solved: 10 Years, 7 Months, 3 Weeks ago
Hi Saket,
Sorry i got late, But Yes It worked for me.
Thanks a ton !!!!!!

Rehards,
SK
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)