Answered by:
document.body.innerhtml doesn´t work with internet explorer 9

Question
-
Hi,
Im using:
dim ie as object
set ie = createobject("internetexplorer.application")
s = ie.document.body.innerhtml
to retrieve the html source for the s variable.
This has worked until we switched to windows 7 and internet explorer 9.
How do I get the html now?
thanks!
Answers
-
Hi,
Welcome to MSDN forum.
Since you didn’t assign the address, ie.document was not available.
You could debug the code and find the object as below:
Here is a sample to get HTML for your reference:
Sub testIE() Dim ie As Object Set ie = CreateObject("internetexplorer.application") ie.Visible = True ie.Navigate2 "www.msdn.com" Do Until ie.ReadyState = 4 DoEvents Loop Do While ie.Busy DoEvents Loop s = ie.Document.Body.innerhtml End Sub
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- Marked as answer by George HuaModerator Thursday, April 10, 2014 4:03 PM
All replies
-
-
-
-
-
When I have issues like that I add the library to my references so I can see the properties and methods in the Intellisense by declaring the variable specifically. Maybe that doesn't exist in IE 9.
Once you debug you can always remove the library.
Bill Mosca
www.thatlldoit.com
http://tech.groups.yahoo.com/group/MS_Access_Professionals -
Hi,
Welcome to MSDN forum.
Since you didn’t assign the address, ie.document was not available.
You could debug the code and find the object as below:
Here is a sample to get HTML for your reference:
Sub testIE() Dim ie As Object Set ie = CreateObject("internetexplorer.application") ie.Visible = True ie.Navigate2 "www.msdn.com" Do Until ie.ReadyState = 4 DoEvents Loop Do While ie.Busy DoEvents Loop s = ie.Document.Body.innerhtml End Sub
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- Marked as answer by George HuaModerator Thursday, April 10, 2014 4:03 PM
-
Sub testIE() Dim ie As Object, s As Variant, objDoc As Object Set ie = CreateObject("internetexplorer.application") ie.Visible = True ie.Navigate2 "http://www/" '"www.msdn.com" Set objDoc = ie.Document Set ie = Nothing End Sub
Set objDoc = ie.Document '...ERROR...WHY ?
Hi , it was yesterday OK (DEBUG.WATCH.IE...) , TODAY...ERR
? err, err.Description
-2147023179 Automation error,The interface is unknown.? ie.ReadyState
0 //READYSTATE_UNINITIALIZED
.............AFTER NAVIGATE // MANUALLY OR PROGRAMMATICALLY...
ie.Navigate2 "http://www/" ' PAGE IS LOADING...OK
-2147023179 Automation error,The interface is unknown.
dBase,FoxPro,MS Access 2003,(2010=Not rec.),Office 2010+ACC.2013 ,Symbian C++, AC.2013.SystemResource.GetCurrentFreeSize=?
- Edited by PACALA_BA Friday, November 6, 2015 3:35 PM
-
possible reason....?
IE9 "Protected Mode"... causes com objcreate pointer to be invalid
ie9-protected-mode-causes-comobjcreate-pointer-to-be-invalid
dBase,FoxPro,MS Access 2003,(2010=Not rec.),Office 2010+ACC.2013 ,Symbian C++, AC.2013.SystemResource.GetCurrentFreeSize=?
- Edited by PACALA_BA Friday, November 6, 2015 4:27 PM