展开全部
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)
在窗体中放置一个WEBbrowser控件,放置一个richtextbox控件
代码:
Private Sub Form_Load()
WebBrowser1.Navigate "http://www.sohu.com"
End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Text1.Text = WebBrowser1.Document.documentElement.outerHTML
End Sub
如需修改网页内容,增加以下代码:
Private Sub Command1_Click()
Dim wdoc As HTMLDocument
Set wdoc = WebBrowser1.Document
wdoc.body.innerHTML = "<font size=10>dfkdjfkdfjdkfjdkfjdk</font>" ‘网页内容
'WebBrowser1.Document.body.innerHTML = "<font size=10>dfkdjfkdfjdkfjdkfjdk</font>" 与上句二选一
End Sub
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)
在窗体中放置一个WEBbrowser控件,放置一个richtextbox控件
代码:
Private Sub Form_Load()
WebBrowser1.Navigate "http://www.sohu.com"
End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Text1.Text = WebBrowser1.Document.documentElement.outerHTML
End Sub
如需修改网页内容,增加以下代码:
Private Sub Command1_Click()
Dim wdoc As HTMLDocument
Set wdoc = WebBrowser1.Document
wdoc.body.innerHTML = "<font size=10>dfkdjfkdfjdkfjdkfjdk</font>" ‘网页内容
'WebBrowser1.Document.body.innerHTML = "<font size=10>dfkdjfkdfjdkfjdkfjdk</font>" 与上句二选一
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询