Provided you can go VBE > Tools > References > Add a reference to Microsoft HTML Object Library you can do the following:
Read all the urls into an array. Loop the array and use xmlhttp to issue GET
request to page. Read the response into an HTMLDocument
variable and use css selector to extract the title and store in an array. At the end of the loop write all results out to sheet in one go.
Option Explicit
Public Sub GetTitles()
Dim urls(), ws As Worksheet, lastRow As Long, results(), i As Long, html As HTMLDocument
Set html = New HTMLDocument
Set ws = ThisWorkbook.Worksheets("Sheet1")
With ws
lastRow = .Cells(.rows.Count, "A").End(xlUp).Row
urls = Application.Transpose(.Range("A2:A" & lastRow).Value)
End With
ReDim results(1 To UBound(urls))
With CreateObject("MSXML2.XMLHTTP")
For i = LBound(urls) To UBound(urls)
If InStr(urls(i), "http") > 0 Then
.Open "GET", urls(i), False
.send
html.body.innerHTML = .responseText
results(i) = html.querySelector(".uiHeaderTitle span").innerText
End If
Next
End With
ws.Cells(2, 2).Resize(UBound(results), 1) = Application.Transpose(results)
End Sub
Matching of css selector to page:
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…