Noobllianz
New Member
- Joined
- Jul 1, 2018
- Messages
- 18
Hi Everyone.
Appreciate if you can help me before I go insane.
I have some started some code where I am making a search Bing (I had trouble finding google headers)
I need to get all the h2 headers on the first page and the text below it.
I have tried in my code to paste it into a listbox but i keep getting "object HTML Heading Element".
Is there a way to print all results in columns and row by row?
Just need the first 10 results
I dont mind if the results are placed into cells.
Appreciate the help please.
Appreciate if you can help me before I go insane.
I have some started some code where I am making a search Bing (I had trouble finding google headers)
- search bing using a string (I have code which splits it apart and I have some formulas to get the url)
- Find all h2 Headings
- innertext? I would love the h2 headings and the text below it.
I need to get all the h2 headers on the first page and the text below it.
I have tried in my code to paste it into a listbox but i keep getting "object HTML Heading Element".
Is there a way to print all results in columns and row by row?
Just need the first 10 results
I dont mind if the results are placed into cells.
Appreciate the help please.
Code:
Sub test()
Dim insured As String
Dim fullname As Variant
Dim i As Integer
Dim strAddress As String
Dim strAddressParts() As String
Dim numParts As Integer
Dim lastrow As Long
Dim ie As Object
Dim tabclass As Object
Dim li As Object
Sheets("Engine").Range("A1:A15").ClearContents
strAddress = Sheets("Sheet1").Range("C4").Value
strAddressParts = Split(strAddress, " ")
numParts = UBound(strAddressParts) + 1
Sheets("Engine").Range("A1").Resize(numParts).Value = WorksheetFunction.Transpose(strAddressParts)
insured = Sheets("Engine").Range("C1")
Set ie = CreateObject("InternetExplorer.Application")
my_url = insured
ie.Visible = True
ie.navigate my_url
Do While ie.readyState = 4: DoEvents: Loop
Do Until ie.readyState = 4: DoEvents: Loop
Application.Wait (Now + TimeValue("0:00:02"))
''''''''''''''''''''''''''''''''''''''''''''''''
Set Allhyperlinks = ie.document.getElementsByTagName("h2")
Sheet1.ListBox1.Clear
For Each hyper_link In Allhyperlinks
Sheet1.ListBox1.AddItem (hyper_link)
Next
End Sub
Last edited: