Cool_Pacific
New Member
- Joined
- May 26, 2017
- Messages
- 7
Hello there,
I have just started writing VBA scripts, I want to scrap a web page source which is using iFrame. I need help getting the data extracted from below web page
A F Enterprises Stock Charts, A F Ent Live Market Technical Charts
I want to read 52 week high, low, historic data, moving average etc from that web page. But I am stuck with iFrame.
I tried below after googling out about iFrame, anybody can help me get going?
Dim baseURL As String
Dim IE As InternetExplorer
Dim HTMLdoc As HTMLDocument
Dim profileFrame As HTMLIFrame
Dim slotsDiv As HTMLDivElement
baseURL = "http://www.moneycontrol.com"
Set IE = New InternetExplorer
With IE
.Visible = True
'Navigate to the main page
.Navigate baseURL & "/stock-charts/" & Ticker & "/charts/" & subTicker & ""
While .Busy Or .READYSTATE <> READYSTATE_COMPLETE: DoEvents: Wend
'Get the profileFrame iframe and navigate to it
Set profileFrame = .Document.getElementById("charts")
.Navigate baseURL & profileFrame.src
While .Busy Or .READYSTATE <> READYSTATE_COMPLETE: DoEvents: Wend
Set HTMLdoc = .Document
End With
'Display all the text in the profileFrame iframe
MsgBox HTMLdoc.body.innerText
'Display just the text in the slots_container div
Set slotsDiv = HTMLdoc.getElementById("slots_container")
MsgBox slotsDiv.innerText
I have just started writing VBA scripts, I want to scrap a web page source which is using iFrame. I need help getting the data extracted from below web page
A F Enterprises Stock Charts, A F Ent Live Market Technical Charts
I want to read 52 week high, low, historic data, moving average etc from that web page. But I am stuck with iFrame.
I tried below after googling out about iFrame, anybody can help me get going?
Dim baseURL As String
Dim IE As InternetExplorer
Dim HTMLdoc As HTMLDocument
Dim profileFrame As HTMLIFrame
Dim slotsDiv As HTMLDivElement
baseURL = "http://www.moneycontrol.com"
Set IE = New InternetExplorer
With IE
.Visible = True
'Navigate to the main page
.Navigate baseURL & "/stock-charts/" & Ticker & "/charts/" & subTicker & ""
While .Busy Or .READYSTATE <> READYSTATE_COMPLETE: DoEvents: Wend
'Get the profileFrame iframe and navigate to it
Set profileFrame = .Document.getElementById("charts")
.Navigate baseURL & profileFrame.src
While .Busy Or .READYSTATE <> READYSTATE_COMPLETE: DoEvents: Wend
Set HTMLdoc = .Document
End With
'Display all the text in the profileFrame iframe
MsgBox HTMLdoc.body.innerText
'Display just the text in the slots_container div
Set slotsDiv = HTMLdoc.getElementById("slots_container")
MsgBox slotsDiv.innerText