Hi Experts,
A newbie here.
I am writing a script to enter multiple roles in the user's roles tab through script. I am able to achieve it partially but it stops when it comes to scroll to the next page & take the roles from excel sheet.
Below is my code, please take a look & advise to achieve this.
If Not IsObject(application) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(connection) Then
Set connection = application.Children(0)
End If
If Not IsObject(session) Then
Set session = connection.Children(0)
End If
If IsObject(WScript) Then
WScript.ConnectObject session, "on"
WScript.ConnectObject application, "on"
End If
Dim ExcelApp, ExcelWorkbook, ExcelSheet, Row ,Col
Set ExcelApp=CreateObject("Excel.Application")
Set ExcelWorkbook=ExcelApp.Workbooks.Open("C:\Users\KH269140\Desktop\ie_data.xls")
Set ExcelSheet=ExcelWorkbook.WorkSheets(2)
Row=1
Col=0
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").text = "/nsu01"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/ctxtUSR02-BNAME").text = "test"
session.findById("wnd[0]/usr/ctxtUSR02-BNAME").caretPosition = 4
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/tbar[1]/btn[18]").press
session.findById("wnd[0]/usr/tabsTABSTRIP1/tabpACTG").select
Do Until ExcelSheet.Cells(Row,1).Value=""
MsgBox "Value:" &Col
session.findById("wnd[0]/usr/tabsTABSTRIP1/tabpACTG/ssubMAINAREA:SAPLSUU5:0106/tblSAPLSUU5TC_AGR/ctxtUSAGR-AGR_NAME[1,"& Col &"]").text = ExcelSheet.Cells(Row,1).value
session.findById("wnd[0]").sendVKey 0
Col=Col+1
if Col>12 Then
session.findById("wnd[0]/usr/tabsTABSTRIP1/tabpACTG/ssubMAINAREA:SAPLSUU5:0106/tblSAPLSUU5TC_AGR").verticalScrollbar.position = 12
Col=1
End if
Row=Row+1
Loop
session.findById("wnd[0]").sendVKey 11
ExcelApp.Quit
Set ExcelApp=Nothing
Set ExcelWorkbook=Nothing
Set ExcelSheet=Nothing
Set ExcelSheet1=Nothing
Any help will be great.
Thanks,
Khagendra