I am trying to navigate through a website by using getElementsbyTagName. It appears after my first trial it does not work and there is an error.
Could someone give me some advice on where I am going wrong. i've noticed T in innertext is capitalised as well if that makes a difference
Rich (BB code):
the_start:
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.Top = 0
ie.Left = 0
ie.Width = 800
ie.Height = 600
URL = Insurance Regulatory Authority
ie.Navigate URL
Do
DoEvents
If Err.Number <> 0 Then
ie.Quit
Set ie = Nothing
Goto the_start:
End If
Loop Until ie.ReadyState = 4
Dim Doc As HTMLDocument
Set Doc = ie.Document
Dim Std As String
Set AllLinks = Doc.getElementsByTagName("a")
For Each hyperlink In AllLinks
If InStr(hyperlink.href, "/index.php/acts") > 0 Then
hyperlink.Click
Exit For
End If
Next
'going on to the next website
Do
DoEvents
If Err.Number <> 0 Then
ie.Quit
Set ie = Nothing
Goto the_start:
End If
Loop Until ie.ReadyState = 4
' it is fine up till this point
Set AllLinks = Doc.getElementsByTagName("a")
For Each hyperlink In AllLinks
MsgBox hyperlink.innerText & " - " & hyperlink.href
Next
End Sub
' it loops once for the search but then I get a debugging error
Last edited: