根据http://dev.csdn.net/develop/article/17/17697.shtm上面的方法 为什么我提取的表格时空的?以下是我的程序 各位前辈帮我看看那里出错了?
Option Explicit
Dim Page As Long
Private Sub Form_Load()
Form1.MousePointer = 11
WebBrowser1.Navigate "file:///C:/Documents%20and%20Settings/willisNE/桌面/论文/陈欣卓%20--%20(模拟电子技术A)%20--%20平时成绩输入.htm" ' 起始网址
End SubPrivate Sub WebBrowser1_StatusTextChange(ByVal Text As String)
Dim Table1 As HTMLTable, Tables As IHTMLElementCollection
Dim Row As HTMLTableRow, Cell As HTMLTableCell
Dim i, j, tmp
Dim Text2 As String
Dim pDisp As Object
Dim Text1 As Integer
Text2 = WebBrowser1.LocationURL ' 显示当前网址
' 判断当前网页是否全部调入完毕
If Not (pDisp Is WebBrowser1.Object) Then Exit Sub
On Error Resume Next
WebBrowser1.Navigate "file:///C:/Documents%20and%20Settings/willisNE/桌面/论文/陈欣卓%20--%20(模拟电子技术A)%20--%20平时成绩输入.htm" ' 起始网址
Set Tables = WebBrowser1.Document.getElementsByTagName("Table")
For Each Table1 In Tables
If Left(Table1.innerText, 2) = "编号" Then ' 找到需要的Table
' 将表格转换成“.csv”格式
For i = 1 To Table1.rows.length - 1
Set Row = Table1.rows(i)
j = 0
For Each Cell In Row.cells
Text1 = Text1 + Trim(Row.cells(j).innerText) + ","
j = j + 1
Next
Text1 = Left(Text1, Len(Text1) - 1) + vbCrLf
Next
' 数据存盘
Open "C:\Program Files\Microsoft Visual Studio\VB98\论文\Data.csv" For Append As #1
Print #1, Left(Text1, Len(Text1) - 2): Text1 = "": Close #1
Exit For
End If
Next
' 上网任务完成后,应在此调用自动挂断过程。
Form1.MousePointer = 0
MsgBox "Finished!!": End
End Sub