VBScript and Frames using contentWindow

marcoVera

New Member
Joined
Feb 8, 2013
Messages
19
Hello Guys,

I have this issue, I'm creating a Macro that is automating a process in a Web Page, but this page have a lot of frames. So when I get the value of the object
it only have the values of the frame

Code:
 Set IE = CreateObject("InternetExplorer.Application")
     IE.Visible = False
    IE.Navigate Sheet1.Range("A3").Value
MsgBox IE.Document.Body.innerHTML

I justo get the principal <FRAME>content for example:

Code:
<FRAME id=rbottom target="contents" scrolling="no" noResize src="/logon/hidden.htm" name="rbottom"><FRAME id=rhidden target="contents" scrolling="no" src="/test/logon.jsp" name="rhidden"><FRAME id=PApplet target="rtop" scrolling="no" noResize src="/test/login.jsp" name="PApplet">
[FRAME id=rbottom name=rbottom src="/logon/hidden.htm" noResize scrolling=no target="contents"][FRAME id=rhidden name=rhidden src="/test/logon.jsp" scrolling=no target="contents"][FRAME id=PApplet name=PApplet src="/test/login.jsp" noResize scrolling=no target="rtop"]

And I cant get the objects like the buttons, divs, inputs, etc. That are in the pages like login.jsp, logon.jsp

I read something about contentWindow property but I cant find how can I use it.
Someone have any example? or How could I get the buttons, etc of those pages?

Thanks in advance, regards!
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Hello Guys,

I have this issue, I'm creating a Macro that is automating a process in a Web Page, but this page have a lot of frames. So when I get the value of the object
it only have the values of the frame

Code:
 Set IE = CreateObject("InternetExplorer.Application")
     IE.Visible = False
    IE.Navigate Sheet1.Range("A3").Value
MsgBox IE.Document.Body.innerHTML

I justo get the principal <FRAME>content for example:

Code:
<FRAME id=rbottom name="rbottom" src="/logon/hidden.htm" noResize scrolling="no" target="contents"><FRAME id=rhidden name="rhidden" src="/test/logon.jsp" scrolling="no" target="contents"><FRAME id=PApplet name="PApplet" src="/test/login.jsp" noResize scrolling="no" target="rtop">
[FRAME id=rbottom name=rbottom src="/logon/hidden.htm" noResize scrolling=no target="contents"][FRAME id=rhidden name=rhidden src="/test/logon.jsp" scrolling=no target="contents"][FRAME id=PApplet name=PApplet src="/test/login.jsp" noResize scrolling=no target="rtop"]

And I cant get the objects like the buttons, divs, inputs, etc. That are in the pages like login.jsp, logon.jsp

I read something about contentWindow property but I cant find how can I use it.
Someone have any example? or How could I get the buttons, etc of those pages?

Thanks in advance, regards!

I tried with this, but it doesn't work :S what could I change?
Code:
 Dim IE As Object
 Dim testIE As Object
Set IE = CreateObject("InternetExplorer.Application") 
IE.Visible = False 
IE.Navigate Sheet1.Range("A3").Value 
MsgBox IE.Document.Body.innerHTML
''''''''''''''
 testIE = IE.Document.getElementById("PApplet") 'The Id of the frame
                 MsgBox testIE.contentWindow.document.Body.innerHTML
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,259
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top