'使用VB获得一页的HTML代码
'加入WebBrowser、Timer、CommandButton控件各一个,然后使用以下代码:Private Sub Command1_Click()
Dim doc As Object
Dim objhtml As Object
Dim i As Integer
Dim strhtml As String
If Not WebBrowser1.Busy Then
Set doc = WebBrowser1.Document
i = 0
Set objhtml = doc.body.createtextrange()
If Not IsNull(objhtml) Then
txtHTML.Text = objhtml.htmltext
Set doc = Nothing
Set objhtml = Nothing
End If
Timer1.Enabled = False
End If
End SubPrivate Sub Form_Load()
Dim HtmlFile As String
HtmlFile = App.Path & "your.htm"
WebBrowser1.Navigate HtmlFile
End Sub
'加入WebBrowser、Timer、CommandButton控件各一个,然后使用以下代码:Private Sub Command1_Click()
Dim doc As Object
Dim objhtml As Object
Dim i As Integer
Dim strhtml As String
If Not WebBrowser1.Busy Then
Set doc = WebBrowser1.Document
i = 0
Set objhtml = doc.body.createtextrange()
If Not IsNull(objhtml) Then
txtHTML.Text = objhtml.htmltext
Set doc = Nothing
Set objhtml = Nothing
End If
Timer1.Enabled = False
End If
End SubPrivate Sub Form_Load()
Dim HtmlFile As String
HtmlFile = App.Path & "your.htm"
WebBrowser1.Navigate HtmlFile
End Sub
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货