Hello all,
I am trying to fill a webform with the details from an excel sheet. It contains few textboxes and dropdown list. I have to select a value from the dropdown list. I am able to fill the textboxes but not able to access the dropdown list. I don't know where I am going wrong. I am attaching the code. Kindly help me to proceed.
Code:
Dim objFile, strGuyFile, intRow
Dim objExcel, strPathExcel, col1, objSheet, col2
Dim objFSO,objFolder,FolderPath, Filescoll
WScript.Echo "hello"
'FolderPath = "C:\Admin\file.xls"
path = "C:\Admin\file.xls"
Set objFSO=CreateObject("Scripting.FileSystemObject")
'Set objFolder=objFSO.GetFolder(FolderPath)
Set objExcel = CreateObject("Excel.Application")
objExcel.Workbooks.open path
WScript.Echo "file opened"
'WScript.Echo path
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)
intRow = 2
Do Until intRow=6
col1 = Trim(objSheet.Cells(intRow, 1).Value)
col2 = Trim(objSheet.Cells(intRow, 2).Value)
col3 = Trim(objSheet.Cells(intRow, 4).Value)
col4 = Trim(objSheet.Cells(intRow, 11).Value)
col5 = Trim(objSheet.Cells(intRow, 10).Value)
WScript.Echo col1 & " ," & col2
intRow = intRow+1
Loop
objExcel.Quit
set a = createobject("wscript.shell")
a.run "http://xxx.com" (not displaying the site name)
wscript.sleep (8000)
a.SendKeys "{TAB 5}"
wscript.sleep (2000)
a.sendkeys (col1)
a.SendKeys "{TAB}"
a.sendkeys (col2)
a.SendKeys "{TAB}"
a.sendkeys (col3)
a.SendKeys "{TAB}"
a.sendkeys (col3)
a.SendKeys "{TAB}"
a.sendkeys (col2)
a.SendKeys "{TAB}"
a.sendkeys (col4)
a.SendKeys "{TAB}"
a.sendkeys (col4)
a.SendKeys "{TAB}"
a.SendKeys (col5)
a.SendKeys "{TAB}"
SetCombo()
Public Sub SetCombo()
'WScript.Echo "hi"
Set objSW = CreateObject("ShellWindows.Application")
Set obj = CreateObject("InternetExplorer.Application")
'On Error Resume Next
For Each Obj In objSW
objLoc = ""
objLoc = Obj.LocationName
Debug.Print objLoc
If objLoc = "xxx.com::Userpanel" Then 'Tested with IE6
i = 0
'WScript.Echo obj.document.All.Item(sbHolder_5775136).Value
For Each i In Obj.document.All.Item("94049960").Value
If (StrComp(i,Kolkata)=0) Then
WScript.Echo "true"
Else
WScript.Echo "false"
End if
Exit For
Next
Exit For
End If
Next
Set Obj = Nothing
End Sub
'WScript.Echo obj.sbHolder_5775136.value
a.SendKeys "{TAB 3}"
a.SendKeys "{ENTER}"
call msgbox("Finished")
wscript.quit
Kindly help me.
Thanks in Advance