rivate Sub Command1_Click()
Dim YDM
YDM = WebBrowser1.Document.body.createtextrange().htmltext
Open "D:\WEB.html" For Output As #1
Print #1, YDM
Close #1
End Sub
=================
工程里引用:Microsoft HTML object Library
工程里部件:Microsoft Internet controls
Microsoft rich textbox controls 6.0 (SP6)
在窗體中放置一個(gè)WEBbrowser控件,放置一個(gè)richtextbox控件
代碼:
Private Sub Form_Load()
WebBrowser1.Navigate "End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Text1.Text = WebBrowser1.Document.documentElement.outerHTML
End Sub
如需修改網(wǎng)頁(yè)內(nèi)容,增加以下代碼:
Private Sub Command1_Click()
Dim wdoc As HTMLDocument
Set wdoc = WebBrowser1.Document
wdoc.body.innerHTML = "<font size=10>dfkdjfkdfjdkfjdkfjdk</font>" ‘網(wǎng)頁(yè)內(nèi)容
'WebBrowser1.Document.body.innerHTML = "<font size=10>dfkdjfkdfjdkfjdkfjdk</font>" 與上句二選一
End Sub