(Solved) – Excel VB extract specific text from Internet explorer


i have this Html and VBA codes as shown below, i am trying to Use excel VBA to extract the name Verizon Wireless only so i used the Following excel VBA Code. But when i run it it is returning “Type:Mobile” I’m assuming this is because the Class name i used is shared by both children under that div so my questions is, is there a way to just extract the name of the carrier?


-------HTML CODE-------

(405) 482-3431

Type: Mobile

Carrier: Verizon Wireless

------VBA CODE------- Sub get_carrier() Dim ie As InternetExplorer Dim ht As HTMLDocument Dim num As String num = Range("B1").Value Set ie = New InternetExplorer ie.navigate ("https://www.whitepages.com/phone/1-405-482-3431") ie.Visible = True Do DoEvents Loop Until ie.readyState = 4 Application.Wait Now TimeSerial(0, 0, 5) Set ht = ie.document Set tags = ht.getElementsByClassName("subtext grey phone-details") For Each tagx In tags MsgBox tagx.innerText Exit For Next End Sub ```

Leave a Reply

Your email address will not be published. Required fields are marked *