chadcollings
Board Regular
- Joined
- Oct 13, 2009
- Messages
- 82
Afternoon,
I am trying to automate some IE navigation. I am running into an issue when trying to populate a field. The object will allow for text entry - but i cannot seem to find a way to fire/trigger an event to populate the dropdown list that will then allow me to select from their "approved" list items.
When i get to the point of "clicking" the button, it will error out the location object.
I have commented out the line having the issue
I am using Office 2016 32 bit on a Windows 10 Machine.
Any help would be GREATLY appreciated. As i have been beating my head against this all day.
I am trying to automate some IE navigation. I am running into an issue when trying to populate a field. The object will allow for text entry - but i cannot seem to find a way to fire/trigger an event to populate the dropdown list that will then allow me to select from their "approved" list items.
When i get to the point of "clicking" the button, it will error out the location object.
I have commented out the line having the issue
I am using Office 2016 32 bit on a Windows 10 Machine.
Any help would be GREATLY appreciated. As i have been beating my head against this all day.
Code:
''REFERENCES - Microsoft Scripting Runtime
Sub Car_Check()
Dim objIE As Object
Set objShell = CreateObject("Shell.Application")
Set objAllWindows = objShell.Windows
On Error GoTo ErrHandler
TargetURL = "https://www.costcotravel.com/h=4005"
Set objIE = New InternetExplorerMedium
objIE.navigate TargetURL
Do While objIE.readyState <> 4 Or objIE.Busy
DoEvents
Loop
objIE.document.getElementById("pickupLocationTextWidget").Focus
''-------------------------------cant fire event to select drop down options
objIE.document.getElementById("pickupLocationTextWidget").Value = "(MCO) Orlando International , FL"
''-------------------------------
objIE.document.getElementById("pickUpDateWidget").Value = "08/31/2019"
objIE.document.getElementById("pickupTimeWidget").Value = "05:00 PM"
objIE.document.getElementById("dropOffDateWidget").Value = "09/12/2019"
objIE.document.getElementById("dropoffTimeWidget").Value = "06:00 AM"
objIE.document.getElementById("findMyCarButton").Click
Exit Sub
''Find Window when IE window is lost
ErrHandler:
For Each ow In objAllWindows
If (InStr(1, ow, "Internet Explorer", vbTextCompare)) Then
I = 0
If ow = "Internet Explorer" Then
Set objIE = ow
End If
End If
Next
Resume
End Sub