safetybelt
01-24-2012, 04:59 PM
Hey guys, so I've found a few threads similar to my problem and used what I saw to try to overcome my issue, but it has been to no avail.
Here is the relevant code:
Dim ie As Object, tempStr As String, gamerTag As String, vReadyState As Integer
Set ie = CreateObject("InternetExplorer.Application")
gamerTag = Sheets("Query").Range("B1").Value
ie.Visible = 1
ie.Navigate "-removed-" & gamerTag
vReadyState = 0
Do Until vReadyState = 4
DoEvents
vReadyState = ie.ReadyState
Loop
tempStr = ie.document.body.all.Item("profileFrame").document.body.all.Item("slots_container").innertext
Sheets("Query").Range("D1").Value = tempStr
Set ie = Nothing
The problem I'm having is that it is correctly finding the profileFrame (which is an iframe) that I am looking for, but then it is not finding the correct HTML within that iframe. When I view the source of the fully loaded page using the Chrome Element Viewer, I'm seeing everything as I would expect. IE, however, is not able to access the iframe information for whatever reason.
I've tried using ie.document.body.all.Item("profileFrame").document.body.innertext and .innerhtml, but they are pulling up the wrong HTML (hence why it's unable to find the "slots_container" item).
The HTML is throwing me through a loop, it appears to be opening itself within the iframe, but that doesn't seem to make any sense to me :\ I think what is happening is some behind the scenes stuff (which I know next to nothing about) that is causing the site to load a different page within the iframe, even though it appears to be loading itself. Like I mentioned, the Google Chrome Element Viewer has the source exactly how I would expect it to be... but "ie.document.body.innerhtml" is giving me something completely different than what Chrome is giving me (and also different than the source manually viewed in IE, but that is to be expected with all the divs and iframes).
If anyone has any ideas, please let me know; I've been pulling my hair out for awhile over this...
This is on Windows 7 using Excel 2003 if that matters. I welcome anyone who can offer any suggestions, thank you!
I cannot post this without removing the link from the relevant VBA as well as a link to the source site. I have removed them both... Hopefully someone will know what I'm talking about without having the actual link!
Here is the relevant code:
Dim ie As Object, tempStr As String, gamerTag As String, vReadyState As Integer
Set ie = CreateObject("InternetExplorer.Application")
gamerTag = Sheets("Query").Range("B1").Value
ie.Visible = 1
ie.Navigate "-removed-" & gamerTag
vReadyState = 0
Do Until vReadyState = 4
DoEvents
vReadyState = ie.ReadyState
Loop
tempStr = ie.document.body.all.Item("profileFrame").document.body.all.Item("slots_container").innertext
Sheets("Query").Range("D1").Value = tempStr
Set ie = Nothing
The problem I'm having is that it is correctly finding the profileFrame (which is an iframe) that I am looking for, but then it is not finding the correct HTML within that iframe. When I view the source of the fully loaded page using the Chrome Element Viewer, I'm seeing everything as I would expect. IE, however, is not able to access the iframe information for whatever reason.
I've tried using ie.document.body.all.Item("profileFrame").document.body.innertext and .innerhtml, but they are pulling up the wrong HTML (hence why it's unable to find the "slots_container" item).
The HTML is throwing me through a loop, it appears to be opening itself within the iframe, but that doesn't seem to make any sense to me :\ I think what is happening is some behind the scenes stuff (which I know next to nothing about) that is causing the site to load a different page within the iframe, even though it appears to be loading itself. Like I mentioned, the Google Chrome Element Viewer has the source exactly how I would expect it to be... but "ie.document.body.innerhtml" is giving me something completely different than what Chrome is giving me (and also different than the source manually viewed in IE, but that is to be expected with all the divs and iframes).
If anyone has any ideas, please let me know; I've been pulling my hair out for awhile over this...
This is on Windows 7 using Excel 2003 if that matters. I welcome anyone who can offer any suggestions, thank you!
I cannot post this without removing the link from the relevant VBA as well as a link to the source site. I have removed them both... Hopefully someone will know what I'm talking about without having the actual link!