文件名称:VB中WebBrowser控件运用 自动获取网页表格数据 网页表格内容自动提取 VB源码
文件大小:30KB
文件格式:RAR
更新时间:2014-08-30 15:21:33
VB中WebBrowser运用,读取网页表格内容,网页表格数据获取,网页表格提取,VB源码,VB代码
'此代码发布后,可随意改哈,欢迎光临我的网址导航网站 http://www.97tt.org Private Declare Function ShellExecute Lib "shell32.dll" Alias _ "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _ ByVal lpFile As String, ByVal lpParameters As String, _ ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long Private Sub Command1_Click() Unload Me End Sub Private Sub Command2_Click() On Error Resume Next RichTextBox1.Text = "" Dim Tables As IHTMLElementCollection Set Tables = WebBrowser1.Document.getElementsByTagName("Table") Dim Table1 As HTMLTable Dim Row As HTMLTableRow, Cell As HTMLTableCell For Each Table1 In Tables 'Next For i = 1 To Table1.rows.length - 2 ' 逐行处理 Set Row = Table1.rows(i) j = 0 For Each Cell In Row.cells ' 逐列处理 RichTextBox1.Text = RichTextBox1.Text + Trim(Row.cells(j).innerText) + "," j = j + 1 Next ' 一行处理完毕后,去除行尾的逗号并加上回车 RichTextBox1.Text = Left(RichTextBox1.Text, Len(RichTextBox1.Text) - 1) + vbCrLf Next Next End Sub
【文件预览】:
Form1.frm
工程3.vbp
工程3.vbw
Form1.frx
网页表格获取.exe