投稿日 | : 2003/05/10(Sat) 01:20 |
投稿者 | : 魔界の仮面弁士 |
Eメール | : |
URL | : |
タイトル | : Re: フレームで区切られたブラウザー |
> Inetコントロールを使ってWEBブラウザーからHTMLドキュメントを取得するコードを作っているのですが、
> フレームで区切られたページでは各ページのHTMLドキュメントが取得されません。
こんな感じで如何でしょうか。
# エラーチェック等は省略しています。
Option Explicit
Private Sub Form_Load()
WebBrowser1.Navigate2 "http://www.asahi-net.or.jp/~rg7f-tkhs/frame6.html"
End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
SaveDocument "C:\TEST\", pDisp.Document
End Sub
Private Sub SaveDocument(ByVal Folder As String, ByVal Document As Object)
Dim PF As IPersistFile
Dim FileName As String
Dim L As Long
If TypeName(Document) <> "HTMLDocument" Then
Exit Sub
End If
FileName = Document.location.pathname
FileName = Folder & Mid(FileName, InStrRev(FileName, "/") + 1)
Set PF = Document
PF.Save FileName, 0&
Set PF = Nothing
With Document.frames
For L = 0 To .length - 1
SaveDocument Folder, .Item(L).Document
Next
End With
End Sub