my question is to zzzzzooc

dear zzzzzooc with refrence to my previous question
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_21198079.html

everyting is fine. first of all i want to tell u that what i want.
let suppose i open any website. and that website contains frames.
i want to save all the HTMLDocuments from webbrowser and if any HTMLDocument has IFrames then save all IFrames.
upto now i'm able to save all the HTMLDocument within frames and also if First HTMLDocument has one IFrame then it stores as u instructed me.
but it do not work for IFrames of inner HTMLDocuments.
i'm using outer loop for HTMLDocuments and inner loop for IFrames
is this inner loop correct?

If (m_oIE.Document.frames(intLoop).Document.All.tags("IFRAME").length > 0) Then
                For intIFrameLoop = 0 To m_oIE.Document.frames(intLoop).Document.All.tags("IFRAME").length
                    'MsgBox m_oIE.Document.All.tags("IFRAME")(0).contentWindow.Document.body.outerText
                    'MsgBox m_oIE.Document.All.tags("IFRAME")(0).contentWindow.Document.body.outerhtml
                    FILE_TOSAVE_IFRAME = "WebPage" & intLoop & "IFrame" & intIFrameLoop & ".html"
                    Set objIFrameDoc = m_oIE.Document.frames(intLoop).Document
                    Do While objIFrameDoc Is Nothing
                        Set objIFrameDoc = objDoc.All.tags("IFRAME")(intLoop)
                    Loop
                    Open FILES_FOLDER & FILE_TOSAVE_IFRAME For Binary Access Write As #FILE_NUMBER
                    Put #FILE_NUMBER, 1, "<HTML>" + objIFrameDoc.body.outerhtml + "</HTML>"
                    Close #FILE_NUMBER
                    msg = msg & FILES_FOLDER & FILE_TOSAVE_IFRAME & vbCrLf
                Next intIFrameLoop
            End If


hope u understand my problem.
LVL 5
NaeemgAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

zzzzzoocCommented:
:) Add a reference to "Microsoft HTML Object Library" and try the below. It should recursively search through every frame or iframe. There are security permissions though. The IFrame's SRC must be on the same domain (ie: a site from "a.com" cannot have an iframe that points to "b.com"). It'll raise "Permission Denied". The same may exist for regular frames but I won't test. Just a head's up! Also.. it's not fully tested but it *seems* to work.


Option Explicit
Private Sub Command1_Click()
    Call HTMLGet(WebBrowser1.document)
End Sub
Private Sub Form_Load()
    'Browse to test-page...
    WebBrowser1.navigate "file://c:\test.html"
End Sub
Private Sub HTMLGet(ByRef objDoc As HTMLDocument)
    Dim objCol1 As IHTMLElementCollection, objFrm As HTMLFrameElement
    Dim objCol2 As IHTMLElementCollection, objIFrm As HTMLIFrame
    Call HTMLSave(objDoc.body.outerHTML)
    Set objCol1 = objDoc.All.tags("FRAME")
    For Each objFrm In objCol1
        Call HTMLGet(objFrm.contentWindow.document)
    Next objFrm
    Set objCol2 = objDoc.All.tags("IFRAME")
    For Each objIFrm In objCol2
        Call HTMLGet(objIFrm.contentWindow.document)
    Next objIFrm
End Sub
Private Sub HTMLSave(ByVal strHTML As String)
    'change saving routine to whatever.. this is just for testing
    Static lngCnt As Long
    Dim intFF As Integer
    intFF = FreeFile
    Open "c:\TestFile" & lngCnt & ".html" For Binary As intFF
        Put #intFF, 1, strHTML
    Close intFF
    lngCnt = lngCnt + 1
End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
NaeemgAuthor Commented:
Thank you zzzzzooc
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.