Click button not working

Status
Not open for further replies.

Mromano

New Member
Joined
Jan 30, 2017
Messages
37
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
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Status
Not open for further replies.

Forum statistics

Threads
1,213,536
Messages
6,114,215
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top