fredrerik84
Active Member
- Joined
- Feb 26, 2017
- Messages
- 383
Hi guys , thanks to all the help i have gotten here im able to imort most data from web pages I can find. The standard code I use is something like this:
But Im trying to extract data from a site here that uses li class and ul classes. I have been trying some different thing but so far I get nothing into excel also no error code
What do I need to do to import li classes, I tried something like this:
But dosnt work :/ the ul class im trying to import is called "runners" any help would be great </code>
Rich (BB code):
Sub Wwebdownload()
Dim IE As New SHDocVw.InternetExplorer
Dim HTMLDoc As New MSHTML.HTMLDocument
Dim HTMLRows As MSHTML.IHTMLElementCollection
Dim HTMLRow As MSHTML.IHTMLElement
Dim Doc As HTMLDocument
Dim i As Long
Dim j As Long
Dim lr As Long
Dim sheet As Worksheet
Dim wb As Worksheet
Set sheet = ActiveWorkbook.sheets("Data")
Set wb = ActiveWorkbook.sheets("Failsafe")
Const URL As String = ""
IE.Navigate URL
IE.Visible = True
With IE
Do While .Busy Or .readyState <> READYSTATE_COMPLETE
DoEvents
Loop
End With
Set Doc = IE.document
Set HTMLRows = Doc.getElementsByTagName("td")
j = 1
For i = 1 To HTMLRows.Length
wb.Cells(j, "B").Value = HTMLRows(i).Cells(i).innerText
j = j + 1
Next i
End Sub
But Im trying to extract data from a site here that uses li class and ul classes. I have been trying some different thing but so far I get nothing into excel also no error code
What do I need to do to import li classes, I tried something like this:
Rich (BB code):
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; white-space: inherit;">Set HTMLRows = Doc.getElementsByTagName("li")
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; white-space: inherit;">Set HTMLRows = Doc.getElementsByTagName("ul")</code>
But dosnt work :/ the ul class im trying to import is called "runners" any help would be great </code>