I am trying to click a button on a website. My code works on three button but not the last for some reason it is the last next that does not work.
Public Sub Billing()
Set objie = CreateObject("InternetExplorer.Application")
With objie
.Visible = True
.Silent = True
.Navigate ("http://www.servicechannel.com/sc/login/client_login.asp")
Do Until .ReadyState = READYSTATE_COMPLETE
DoEvents
Loop
Application.Wait Now() + TimeValue("00:00:01")
.Document.all.UserName.Value = MyUserName
.Document.all.Password.Value = MyPassword
.Document.all.RememberMe.Value = True
.Document.forms(0).submit
Do Until .ReadyState = READYSTATE_COMPLETE
DoEvents
Loop
Application.Wait Now() + TimeValue("00:00:01")
End With
With objie
.Visible = True
.Silent = True
.Navigate ("http://www4.servicechannel.com/sc/login/reports/workhistory.asp?rpst=5")
Do Until .ReadyState = READYSTATE_COMPLETE
DoEvents
Loop
Application.Wait Now() + TimeValue("00:00:01")
End With
objie.Document.getElementById("arrow-collapse4").Click
objie.Document.all.dayfrom.Value = dayfrom
objie.Document.getElementById("arrow-collapse7").Click
Dim ele As Object
For Each ele In objie.Document.getElementsByTagName("input")
If ele.Value = "PF" Then ele.Click: Exit For
Next
For Each ele In objie.Document.getElementsByTagName("input")
If ele.Value = "msexc" Then ele.Click: Exit For
Next
For Each ele In objie.Document.getElementsByTagName("input")
If ele.Value = "Retrieve Report" Then ele.Click: Exit For
Next
For Each ele In objie.Document.getElementsByTagName("input")
If ele.Value = "Launch Excel" Then ele.Click: Exit For
Next
End Sub
inspect code
'<input class="btn btn-primary" type="button" name="butLaunchExcel" value="Launch Excel" *******="ExcelLaunch()"> == $0
Public Sub Billing()
Set objie = CreateObject("InternetExplorer.Application")
With objie
.Visible = True
.Silent = True
.Navigate ("http://www.servicechannel.com/sc/login/client_login.asp")
Do Until .ReadyState = READYSTATE_COMPLETE
DoEvents
Loop
Application.Wait Now() + TimeValue("00:00:01")
.Document.all.UserName.Value = MyUserName
.Document.all.Password.Value = MyPassword
.Document.all.RememberMe.Value = True
.Document.forms(0).submit
Do Until .ReadyState = READYSTATE_COMPLETE
DoEvents
Loop
Application.Wait Now() + TimeValue("00:00:01")
End With
With objie
.Visible = True
.Silent = True
.Navigate ("http://www4.servicechannel.com/sc/login/reports/workhistory.asp?rpst=5")
Do Until .ReadyState = READYSTATE_COMPLETE
DoEvents
Loop
Application.Wait Now() + TimeValue("00:00:01")
End With
objie.Document.getElementById("arrow-collapse4").Click
objie.Document.all.dayfrom.Value = dayfrom
objie.Document.getElementById("arrow-collapse7").Click
Dim ele As Object
For Each ele In objie.Document.getElementsByTagName("input")
If ele.Value = "PF" Then ele.Click: Exit For
Next
For Each ele In objie.Document.getElementsByTagName("input")
If ele.Value = "msexc" Then ele.Click: Exit For
Next
For Each ele In objie.Document.getElementsByTagName("input")
If ele.Value = "Retrieve Report" Then ele.Click: Exit For
Next
For Each ele In objie.Document.getElementsByTagName("input")
If ele.Value = "Launch Excel" Then ele.Click: Exit For
Next
End Sub
inspect code
'<input class="btn btn-primary" type="button" name="butLaunchExcel" value="Launch Excel" *******="ExcelLaunch()"> == $0