Nelson78
Well-known Member
- Joined
- Sep 11, 2017
- Messages
- 526
- Office Version
- 2007
Hello everybody.
I'm struggling with some problems in selecting a dropdown navigating in Explorer via vba.
Above the code, until it works:
Now, i've a dropdown to select.
Above the html code:
Maybe for the intrinsic caracteristic of the page (aspx), I can't proceed. I've tried selecting by id and also with Sendkeys, with no positive results.
Could you get me some hints, please?
I'm struggling with some problems in selecting a dropdown navigating in Explorer via vba.
Above the code, until it works:
Code:
sub enter_site ()
Dim myId As String, myCode As String
myId = Range("E9") 'user'
myCode = Range("F9") 'pw'
myURL = "https://aaa/bbb/Authentication/Login.aspx"
Set IE = CreateObject("InternetExplorer.Application")
With IE
.navigate myURL
.Visible = True
Do While .Busy: DoEvents: Loop 'Attesa not busy
Do While .readyState <> 4: DoEvents: Loop 'Attesa documento
End With
myStart = Timer
Do
DoEvents
If Timer > myStart + 1 Or Timer < myStart Then Exit Do
Loop
IE.document.getElementById("UserName").Value = myId
IE.document.getElementById("Password").Value = myCode
Set mycoll = IE.document.getElementsByTagName("Input")
For Each myinp In mycoll
If myinp.ID = "LoginButton" Then
myinp.CLICK
Exit For
End If
Next myinp
Do While IE.Busy: DoEvents: Loop 'Attesa not busy'
Do While IE.readyState <> 4: DoEvents: Loop 'Attesa documento'
IE.document.getElementById("menu").CLICK
IE.document.getElementById("report").getElementsByTagName("a")(4).CLICK
Now, i've a dropdown to select.
Above the html code:
HTML:
<select id="site" title="listsites" onchange="javascript:setTimeout('__doPostBack(\'site\',\'\')', 0)" name="site">
<option value="0" selected="selected">Select</option>
<option value="1">London1</option>
<option value="2">London2</option>
<option value="3">Brighton</option>
<option value="4">London3</option>
Maybe for the intrinsic caracteristic of the page (aspx), I can't proceed. I've tried selecting by id and also with Sendkeys, with no positive results.
Could you get me some hints, please?