bcbc123
03-06-2013, 06:01 PM
Hi guys,
So I'm trying to get the HTML source code from a website, except the website URL never changes. This is what I have so far/what I need help with:
Sub MyVBA()
Dim ie, objDoc, htmlInput As Object
Dim strURI, htmlDOC As String
struURI = "....somewebsite.com"
Set ie = CreateObject("internetexplorer.application")
ie.Navigate strURI
Do
If ie.ReadyState = 4 Then
ie.Visible = True
Exit Do
Else
DoEvents
End If
Loop
Set objDoc = ie.document
Set htmlInput = objDoc.getElementById("insertIDhere")
htmlInput.Click
htmlDOC = objDOC.body.innerHTML
msgBox(htmlDOC)
End Sub
So VBA clicks on the button that I want, and InternetExplorer goes to the new webpage (this part of my code works correctly). The URL, however, never changes. So when I try to get the HTML source code of the new webpage through VBA, VBA gets the HTML source from the original webpage, not the new webpage that I want.
Is there a way to get the source code from the new webpage, not the original webpage?
Thanks!
So I'm trying to get the HTML source code from a website, except the website URL never changes. This is what I have so far/what I need help with:
Sub MyVBA()
Dim ie, objDoc, htmlInput As Object
Dim strURI, htmlDOC As String
struURI = "....somewebsite.com"
Set ie = CreateObject("internetexplorer.application")
ie.Navigate strURI
Do
If ie.ReadyState = 4 Then
ie.Visible = True
Exit Do
Else
DoEvents
End If
Loop
Set objDoc = ie.document
Set htmlInput = objDoc.getElementById("insertIDhere")
htmlInput.Click
htmlDOC = objDOC.body.innerHTML
msgBox(htmlDOC)
End Sub
So VBA clicks on the button that I want, and InternetExplorer goes to the new webpage (this part of my code works correctly). The URL, however, never changes. So when I try to get the HTML source code of the new webpage through VBA, VBA gets the HTML source from the original webpage, not the new webpage that I want.
Is there a way to get the source code from the new webpage, not the original webpage?
Thanks!