Hidden tag or element ID on this web page ???

LouieH

New Member
Joined
Sep 2, 2014
Messages
3
Hi all,
I'm new here from Hong Kong. I'm working on getting web data to Excel 2003 project. During the course, I came across another forum searching for related info. URL: http://www.excelforum.com/excel-pro...must-have-javascript-enabled.html#post3820062 This post was about getting data from a website Fantastic Fiction A guy name Chippy posted the solution code (copied from the forum to below). This code is working fine; however, my question is how to figure out this line

"Set contentDiv = HTMLdoc.getElementById("ffcontent")"

where ffcontent didn't appear on the source codes, innerHTML/text, outerHTML/text etc (from what I knew).

Any idea???

Code copied from http://www.excelforum.com/

Public Sub Get_New_Books()

Dim HTMLdoc As HTMLDocument, HTMLdocTemp As HTMLDocument
Dim contentDiv As HTMLDivElement
Dim bookTable As HTMLTable
Dim r As Integer
Dim destCell As Range
Dim URL As String
Dim lines As Variant

Set destCell = ActiveSheet.Range("A1")
destCell.Parent.Cells.Clear

URL = "http://www.fantasticfiction.co.uk/new-books/"

Set HTMLdocTemp = New HTMLDocument
Set HTMLdoc = HTMLdocTemp.createDocumentFromUrl(URL, "")
While HTMLdoc.readyState <> "complete": DoEvents: Wend

Do
DoEvents
Set contentDiv = HTMLdoc.getElementById("ffcontent")
Loop Until contentDiv.getElementsByTagName("TABLE").Length > 0

r = 0
For Each bookTable In contentDiv.getElementsByTagName("TABLE")
destCell.Offset(r, 0).Value = bookTable.Rows(0).Cells(0).innerText
lines = Split(bookTable.Rows(0).Cells(2).innerText, vbCrLf)
destCell.Offset(r, 1).Resize(1, UBound(lines) + 1).Value = lines
r = r + 1
Next

End Sub
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Forum statistics

Threads
1,222,038
Messages
6,163,542
Members
451,843
Latest member
vitto

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top