Hi,

I am trying to access the links in this webpage using VBA, Though I am able to get the collection of the objects I want, the For Next loop doesn’t work. The htmlinput is empty. So, control doesn't enter the loop.

I tested the same code for another page of this website and it works fine. What is wrong with this page?

Here is my code

….
   Set htmlDoc = .document
   Set htmlColl = htmlDoc.getElementsByTagName("A")
 
  For Each htmlInput In htmlColl
 
   If (Left(htmlInput.getAttribute("innerText"), 11) = "Acrobat PDF") Then
      Str = htmlInput.getAttribute("href")
        counter = counter + 1
        ActiveCell.Offset(counter, 0).Value = Str
 
    End If
 
    Next
 
   Next
 
….