hi guys
I've made a function to save and email a webpage, however in case there is a frame like this:
I dont want save a secondary file and I want to insert it into my main html and all images inside that...Code:<frame src="Pan%20Iranisim%20%20%20One%20United%20Iranian%20Nation_files/pan1.htm" frameborder="no" border="0" noresize="noresize" scrolling="auto">
how to do that?
thanks
here is the part of my code:
Code:Dim objImg As IHTMLImgElement Dim objHypLink As MSHTML.HTMLLinkElement Dim objMSHTML As New MSHTML.HTMLDocument Dim objDoc As HTMLDocument, vFileName, vPath Dim defPath 'Default Path defPath = "C:\Temp\" 'load page Set objDoc = objMSHTML.createDocumentFromUrl(txtAddress, vbNullString) 'wait for loading Dim vTemp AddStat "Start Loading webpage..." Do While objDoc.ReadyState <> "complete" If vTemp <> objDoc.ReadyState Then AddStat objDoc.ReadyState End If vTemp = objDoc.ReadyState DoEvents Loop Dim vFile(), I 'Exit Sub 'save images ReDim vFile(0 To objDoc.images.length) AddStat "Start saving " & objDoc.images.length & " images." For Each objImg In objDoc.images vFile(I) = defPath & Replace(Mid(objImg.src, Len(objDoc.location) + 1), "/", "\") vPath = Mid(vFile(I), InStrRev(vFile(I), "\") + 1) rMkDir Mid(vFile(I), 1, InStrRev(vFile(I), "\")) URLDownloadToFile 0&, objImg.src, vFile(I), 0&, 0& 'MsgBox objImg.src 'MsgBox objImg.src I = I + 1 Next objImg AddStat "Saving " & objDoc.images.length & " images finished." I = 0 'insert frame to main html 'save href for each hyperlink Dim oLink Do Set oLink = objDoc.getElementsByTagName("A")(I) If oLink Is Nothing Then Exit Do oLink.setAttribute "href", objDoc.links(I) '<-- Replace with your link page I = I + 1 Loop AddStat "absoluting href" 'create appropriate name for html file If Right(txtAddress.Text, 1) = "/" Then txtAddress.Text = Mid(txtAddress.Text, 1, Len(txtAddress.Text) - 1) End If If InStrRev(Mid(txtAddress.Text, 8), "/") = 0 Then vFileName = "C:\temp\index.html" Else vStart = InStrRev(Mid(txtAddress.Text, 8), "/") + 8 vFileName = Mid(txtAddress.Text, vStart) vFileName = "C:\temp\" & vFileName If LCase(Right(vFileName, 5)) <> ".html" And Left(Right(vFileName, 4), 1) <> "." Then vFileName = vFileName & ".htm" End If End If ' Save source into html file Dim vText, chText vText = objDoc.documentElement.outerHTML Text1.Text = vText ReDim chText(0 To Len(vText)) AddStat "converting unicode to $#1740;" For I = 0 To Len(vText) - 1 chText(I) = Mid(vText, I + 1, 1) 'MsgBox AscW(Mid(vText, I + 1, 1)) If AscW(chText(I)) > 255 Then chText(I) = "&#" & AscW(chText(I)) & ";" End If DoEvents Next I vText = Join(chText, "") Call CreateFile(vFileName, vText)




Reply With Quote