Hi all,
I am trying to locate Meta tags from the following URL:
https://england.shelter.org.uk/prof...ary_folder/2020_group_-_fiscal_stimulus_paper
However, what is passed from the result string to HTMLDoc.body.all is only a section of the actual HTML and the meta tags at the beginning of the script are absent and so cannot be found. How do I overcome this?
my code is as follows:
I am trying to locate Meta tags from the following URL:
https://england.shelter.org.uk/prof...ary_folder/2020_group_-_fiscal_stimulus_paper
However, what is passed from the result string to HTMLDoc.body.all is only a section of the actual HTML and the meta tags at the beginning of the script are absent and so cannot be found. How do I overcome this?
my code is as follows:
Code:
Dim Http2 As New WinHttpRequest
Dim i as long
dim result as string
dim elements
dim element
Set HTMLDoc = New MSHTML.HTMLDocument
Http2.Open "GET", url, False
' send request
Http2.send
result = Http2.responseText
'pass text of HTML document returned
HTMLDoc.body.all = result
Set Elements = HTMLDoc.all.tags("META")
For Each singleElement In Elements
ActiveSheet.Cells(i, "A") = url
ActiveSheet.Cells(i, "B") = "META " & singleElement.Name
ActiveSheet.Cells(i, "D").NumberFormat = "@" ' text format for date
ActiveSheet.Cells(i, "D") = singleElement.Content
i = i + 1
Next
Set Elements = Nothing