YasserKhalil
Well-known Member
- Joined
- Jun 24, 2010
- Messages
- 852
Hello everyone
I am trying to get the text after each STRONG tag but I can't figure it out
Here's the code so far
I am trying to get the text after each STRONG tag but I can't figure it out
Here's the code so far
Code:
Sub Final()
Dim xmlP As New MSXML2.XMLHTTP60
Dim htmlSubyDoc As New MSHTML.HTMLDocument
Dim htmlSubyResults As MSHTML.IHTMLElementCollection
Dim htmlSubyResult As MSHTML.IHTMLElement
Dim htmlStrongs As MSHTML.IHTMLElementCollection
Dim htmlStrong As MSHTML.IHTMLElement
Dim str As String
Dim r As Long
Dim i As Long
Dim counter As Long
Application.ScreenUpdating = False
xmlP.Open "GET", "http://plants.newgarden.com/12190005/Plant/3394/Deodar_Cedar", False
xmlP.send
If xmlP.Status <> 200 Then
MsgBox "Problem" & vbNewLine & xmlP.Status & " - " & xmlP.statusText
Exit Sub
End If
htmlSubyDoc.body.innerHTML = xmlP.responseText
Set htmlSubyResults = htmlSubyDoc.getElementsByClassName("pdpBox")
For Each htmlSubyResult In htmlSubyResults
'Debug.Print htmlSubyResult.innerHTML
Set htmlStrongs = htmlSubyResult.getElementsByTagName("STRONG")
For Each htmlStrong In htmlStrongs
Debug.Print htmlStrong.innerHTML
Next htmlStrong
Next htmlSubyResult
Application.ScreenUpdating = True
End Sub