I am trying to change my code from IE to Google Chrome and I am getting stuck on the ready state.
Option Explicit
Const MyUserName As String = "ABCOFA"
Const MyPassword As String = "******"
Const dayfrom As String = "12/01/2015"
Const READYSTATE_COMPLETE As Integer = 4
Dim chromePath As String
Dim objie As Object
Public Sub Billing()
'Set objie = CreateObject("InternetExplorer.Application")
chromePath = """C:\Program Files\Google\Chrome\Application\chrome.exe"""
' With objie
' .Visible = True
' .Silent = True
' .Navigate ("https://www.servicechannel.com/sc/login/client_login.asp")
Shell (chromePath & " -url https://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
With objie
.Visible = True
.Silent = True
.Navigate ("https://www4.servicechannel.com/sc/login/reports/aspnet.asp?vrs=1")
Do Until .ReadyState = READYSTATE_COMPLETE
DoEvents
Loop
Application.Wait Now() + TimeValue("00:00:01")
End With
For Each ele In objie.Document.getelementsbytagname("button")
If ele.Name = "butLaunchExcel" Then
ele.Click
Exit For
End If
Next ele
End Sub
Option Explicit
Const MyUserName As String = "ABCOFA"
Const MyPassword As String = "******"
Const dayfrom As String = "12/01/2015"
Const READYSTATE_COMPLETE As Integer = 4
Dim chromePath As String
Dim objie As Object
Public Sub Billing()
'Set objie = CreateObject("InternetExplorer.Application")
chromePath = """C:\Program Files\Google\Chrome\Application\chrome.exe"""
' With objie
' .Visible = True
' .Silent = True
' .Navigate ("https://www.servicechannel.com/sc/login/client_login.asp")
Shell (chromePath & " -url https://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
With objie
.Visible = True
.Silent = True
.Navigate ("https://www4.servicechannel.com/sc/login/reports/aspnet.asp?vrs=1")
Do Until .ReadyState = READYSTATE_COMPLETE
DoEvents
Loop
Application.Wait Now() + TimeValue("00:00:01")
End With
For Each ele In objie.Document.getelementsbytagname("button")
If ele.Name = "butLaunchExcel" Then
ele.Click
Exit For
End If
Next ele
End Sub