shahin
Active Member
Writing a script when I run it I get error. I can't figure out the mistakes I'm doing. Any help would be appreciated. I wanted to get the title of any random sites I would like to input in my excel file. Thanks in advance. Here is what I've tried so far.
Websites I tried with:
Code:
Sub Test_title()
Dim req As New XMLHTTP60, html As New HTMLDocument
Dim topic As Object, post As Object
Dim cel As Range, site As String
For Each cel In Range("A1:A" & Cells(Rows.Count, 1).End(xlUp).row)
If cel.Value <> "" Then
site = "http://" & cel.Value
With req
.Open "GET", site, False
.send
html.body.innerHTML = .responseText
End With
Set topic = html.getElementsByTagName("title")
For Each post In topic
x = x + 1
Cells(x, 2) = post.innerText
Next post
End If
Next cel
End Sub
Websites I tried with:
Code:
www.dailynews.com
www.dailynews.co.zw
www.gulf-daily-news.com
www.dailynews.gov.bw
Last edited: