How to declare contentWindow.document for an iFrame inside another iFrame ?

LouieH

New Member
Joined
Sep 2, 2014
Messages
3
Appreciate if someone can give me a hand on the captioned subject. I’m working on an ERP upgrade project and we are in the process of doing the data normalization. The company is using an Intranet web base (ie8) program along with the Excel 2003 Marco/VBA programs for entering the data. We try to modify the existing Marco/VBA modules in order to speedup the data entry time (over 100K records).
The Intranet program (see below for its HTML codes) contained mainly three sections residing inside three iFrames. (1) User login authentications (login-iFrame) (2) Business logic (WIP-iFrame) (3) Final confirmation (Confirm-iFrame). We are successfully automate/modify the first two iFrames' corresponding VBA modules (see below for our codes); however, we couldn’t make the final third Confirm-iFrame corresponding VBA modules works, in which the third iFrame was generated from a table inside the first iFrame (login-iFrame) with the source “https://” (After the process of business logic completed in iframe 2) Note: the other two iFrames’ sources use “http://” Simply speaking we couldn’t reference the third iFrame using the doc.contentWindows.Document (Permission denied). Please kindly help us with some light how to solve the problem as we are not versed in VBA.
Many thanks!

p.s.: Only one ie browser appeared, all three iframes shown up there, the last (third) iframe won't show up until the corresponding second iframe codes completely executed.


<Our codes:>
Sub dataEntryDept1 ()
Dim ie As SHDocVw.InternetExplorer
Dim HTMLRootDoc As HTMLDocument
Dim HTMLLoginDoc As MSHTML.HTMLDocument
Dim HTMLmainFBdoc As MSHTML.HTMLDocument
Dim HTMLConfirmDoc As MSHTML.HTMLDocument

Dim loginFrame As HTMLIFrame '1st iFrame
Dim mainFBFrame As HTMLIFrame '2nd iFrame
Dim confirmFrame As HTMLIFrame '3rd iFrame

url = "http://intranet.dept1.com"

Set ie = New SHDocVw.InternetExplorer
With ie
.Visible = True
.navigate url
Do While .readyState <> READYSTATE_COMPLETE Or .Busy
DoEvents
Loop
End With

Application.Wait (Now + TimeValue("0:00:10"))

Set HTMLRootDoc = ie.document

Set loginFrame = HTMLRootDoc.getElementById("userlogin") ‘1st iframe
Do
DoEvents
Loop Until loginFrame.readyState = "complete"
Set HTMLDoc = loginFrame.contentWindow.document

Set mainFBFrame = HTMLRootDoc.getElementById("deptLogic") ‘2nd iframe
Do
DoEvents
Loop Until mainFBFrame.readyState = "complete"
Set HTMLmainFBdoc = mainFBFrame.contentWindow.document

Set confirmFrame = HTMLDoc.getElementById("confirmFrameEntry")
Do
DoEvents
Loop Until confirmFrame.readyState = "complete"

*** ERROR Occurred here ***
Set HTMLConfirmDoc = confirmFrame.contentWindow.document ‘3rd iframe
(We tried to use Set HTMLConfirmDoc = confirmFrame.document but no luck at the end)

(HTMLDoc is the document holding the 1st iFrame)

<our code-END>

<Intranet web HTML codes:>

<!-- DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" -->
<body>
******** name="deptLogic" width="100%" height="100%" id="deptLogic" src="/index.aspx?dept=18" frameBorder="0" marginWidth="0" marginHeight="0" ******="addMousedownEvent('deptLogic');">

<div id="iframeDept" style="display: block;"> ' 3rd iFrame here
******** name="userlogin" id="userlogin" src="http://xn.dept1.com/index.aspx" frameBorder="0" marginWidth="0" marginHeight="0" scrolling="no" style="z-index: 2; position: absolute; width: 221px; height: 555px; top: 23px; left: 775px;" allowTransparency="allowtransparency">

<!-- DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" -->
<head>
******** type="text/javascript">document.domain = 'dept1.com';*********>

<body>
<div id="deptConfirm" style="position: absolute; background-color: transparent; >
<div id="deptPreview" style="z-index: 100; background-color: >
<table id="deptPreviewTable" border="0" cellSpacing="0" cellPadding="0">
<tbody>
<tr>
<tr>
<td vAlign="top">
******** name=" confirmFrameEntry " id=" confirmFrameEntry " src="https://xn01.dept1.com /preview.aspx?" frameBorder="0" marginWidth="0" marginHeight="0" scrolling="no" style="border-bottom: 0px; border-left: 0px; width: 100%; height: 400px; border-top: 0px; border-right: 0px;">

<!-- DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
******** type="text/javascript">document.domain = 'dept1.com'; *********>
<head>
<body style="background-color: #ffffff;" onkeydown="return onKeyDown(event);" oncontextmenu="return false" ******="OnPageLoad();">
<table width="100%" height="100%" style="border-bottom: #aa 1px solid; border-left: #aa 1px solid; background-color: #f; border-top: 1px solid;" border="0" cellSpacing="0" cellPadding="0">
<tbody>
<tr>
<tr>
<tr>
<body>


<END-Intranet web HTML codes>
 
Last edited:

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Here is the codes:

(<intranet web="" html="" codes:="">)

(<!-- DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" -->
(
(******** name="deptLogic" width="100%" height="100%" id="deptLogic" src="/index.aspx?dept=18" frameBorder="0" marginWidth="0" marginHeight="0" ******="addMousedownEvent('deptLogic');">

(<div id="iframeDept" style="display: block;"> ' 3rd iFrame here
( ******** name="userlogin" id="userlogin" src="http://xn.dept1.com/index.aspx" frameBorder="0" marginWidth="0" marginHeight="0" scrolling="no" style="z-index: 2; position: absolute; width: 221px; height: 555px; top: 23px; left: 775px;" allowTransparency="allowtransparency">

(<!-- DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" -->

******** type="text/javascript">document.domain = 'dept1.com';*********>


(
(
(
(
(
( ******** name=" confirmFrameEntry " id=" confirmFrameEntry " src="https://xn01.dept1.com /preview.aspx?" frameBorder="0" marginWidth="0" marginHeight="0" scrolling="no" style="border-bottom: 0px; border-left: 0px; width: 100%; height: 400px; border-top: 0px; border-right: 0px;">

(<!-- DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" -->
(
(
( ******** type="text/javascript">document.domain = 'dept1.com'; *********>
(
(
(
(
(
(
(
(


(<end-intranet web="" html="" codes=""></end-intranet>

<tbody>
</tbody>

</div></intranet>
 
Upvote 0

Forum statistics

Threads
1,217,367
Messages
6,136,134
Members
449,994
Latest member
Rocky Mountain High

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