JordanStach
New Member
- Joined
- Sep 19, 2020
- Messages
- 2
- Office Version
- 365
- Platform
- Windows
The code cycles through a huge list of patients and plugs their IDnumber and DoB into a portion of a URL, then opens a webpage to check that they're marked as eligible for some service. That all works fine, but I'm having trouble automating the marking of cells to indicate whether a patient is eligible.
I'm very new (day 4) to this, and I don't have any background in coding, so I'm sort of stuck at sea at this point. Not sure which direction to start moving...
This is a snapshot of the HTML I'm trying to target:
And this is the code (removed the actual URL for privacy):
I get an error on the 'If InStr' line. "Runtime Error 438: Object doesn't support this property or method."
Any advice is appreciated.
I'm very new (day 4) to this, and I don't have any background in coding, so I'm sort of stuck at sea at this point. Not sure which direction to start moving...
This is a snapshot of the HTML I'm trying to target:
And this is the code (removed the actual URL for privacy):
VBA Code:
Sub SomeModule()
FinalRow = Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To FinalRow
Dim IE As New InternetExplorer
IE.Visible = True
IE.Silent = True
IE.navigate "https://website.com/" _
& Range("A" & i).Value _
& "&dob=" _
& Range("C" & i).Value
Do
DoEvents
Loop Until IE.readyState = READYSTATE_COMPLETE
Dim Doc As HTMLDocument
Set Doc = IE.document
If InStr(IE.document.getElementsByClassName("alert alert-success big").innerHTML, "patient is eligible") > 0 Then
Range("F" & i) = "Elligible"
End If
IE.Quit: Set IE = Nothing
Next i
End Sub
I get an error on the 'If InStr' line. "Runtime Error 438: Object doesn't support this property or method."
Any advice is appreciated.