Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 89246

Webscraping using Excel VB getElementsByTagName("a") Only Works Some Of The Time

$
0
0

I have used the following code to successfully pull in data on email into Excel:

Set ElementCol = html.getElementsByTagName("a")

    For Each Link In ElementCol   

        If InStr(Link, "mailto:") Then

            Cells(MyRow, MyCol).Value = Link

            Cells(MyRow, MyCol).Select

            MyCol = MyCol + 1

        End If

    Next 'email address loop

This relates to:

enter image description here

However, I can't use similar code to pull in the name:

enter image description here

I have tried getElementById() and getElementsByClassName and I have tried changing html. to doc. and Text. because I thought the issue could be that an email address is a hyperlink so html. is appropriate but a name is plain text so I should use something else? I am getting Object Required error.


Viewing all articles
Browse latest Browse all 89246

Trending Articles