ataylor135
New Member
- Joined
- Jul 17, 2016
- Messages
- 3
Hello,
I'm trying to create a macro that will navigate to a certain page on a website. In order to do this, I have to navigate to the webpage, then click two buttons to get to where I need to be. My code works fine when I step through line by line, but when I try to run the code straight through, it seems to skip clicking the second button.
Here is my code:
Sub Navigate_To_Starting_Point()
The_Start:
Dim objIE As Object
Dim TB13 As MSForms.TextBox
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Top = 0
objIE.Left = 0
objIE.Width = 800
objIE.Height = 600
objIE.Visible = True
objIE.Navigate ("http://openaccess.sb-court.org/")
Do
DoEvents
If Err.Number <> 0 Then
objIE.Quit
Set objIE = Nothing
GoTo The_Start:
End If
Loop Until objIE.ReadyState = 4
Set TB13 = UserForm1.TextBox13
TB13.Text = objIE.Document.Body.innerHTML
Dim the_input_elements1 As Object
Dim input_element1 As Object
Set the_input_elements1 = objIE.Document.getElementsByTagName("input")
For Each input_element1 In the_input_elements1
If input_element1.getAttribute("value") = "Civil, Fam law, Sm Cl, Probate" Then
input_element1.Click
Exit For
End If
Next input_element1
Do
DoEvents
If Err.Number <> 0 Then
objIE.Quit
Set objIE = Nothing
GoTo The_Start:
End If
Loop Until objIE.ReadyState = 4
Dim the_input_elements2 As Object
Dim input_element2 As Object
Set the_input_elements2 = objIE.Document.getElementsByTagName("input")
For Each input_element2 In the_input_elements2
If input_element2.getAttribute("value") = "Case Number Search" Then
input_element2.Click
Exit For
End If
Next input_element2
Do
DoEvents
If Err.Number <> 0 Then
objIE.Quit
Set objIE = Nothing
GoTo The_Start:
End If
Loop Until objIE.ReadyState = 4
End Sub
Any help you can provide will be greatly appreciated.
I'm trying to create a macro that will navigate to a certain page on a website. In order to do this, I have to navigate to the webpage, then click two buttons to get to where I need to be. My code works fine when I step through line by line, but when I try to run the code straight through, it seems to skip clicking the second button.
Here is my code:
Sub Navigate_To_Starting_Point()
The_Start:
Dim objIE As Object
Dim TB13 As MSForms.TextBox
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Top = 0
objIE.Left = 0
objIE.Width = 800
objIE.Height = 600
objIE.Visible = True
objIE.Navigate ("http://openaccess.sb-court.org/")
Do
DoEvents
If Err.Number <> 0 Then
objIE.Quit
Set objIE = Nothing
GoTo The_Start:
End If
Loop Until objIE.ReadyState = 4
Set TB13 = UserForm1.TextBox13
TB13.Text = objIE.Document.Body.innerHTML
Dim the_input_elements1 As Object
Dim input_element1 As Object
Set the_input_elements1 = objIE.Document.getElementsByTagName("input")
For Each input_element1 In the_input_elements1
If input_element1.getAttribute("value") = "Civil, Fam law, Sm Cl, Probate" Then
input_element1.Click
Exit For
End If
Next input_element1
Do
DoEvents
If Err.Number <> 0 Then
objIE.Quit
Set objIE = Nothing
GoTo The_Start:
End If
Loop Until objIE.ReadyState = 4
Dim the_input_elements2 As Object
Dim input_element2 As Object
Set the_input_elements2 = objIE.Document.getElementsByTagName("input")
For Each input_element2 In the_input_elements2
If input_element2.getAttribute("value") = "Case Number Search" Then
input_element2.Click
Exit For
End If
Next input_element2
Do
DoEvents
If Err.Number <> 0 Then
objIE.Quit
Set objIE = Nothing
GoTo The_Start:
End If
Loop Until objIE.ReadyState = 4
End Sub
Any help you can provide will be greatly appreciated.