我将参考的代码按我的理解改了一下,如下:
Dim web As New System.Windows.Forms.WebBrowser()
web.Navigate("http://hb.122.gov.cn/views/examappointpub.html")
Do Until web.ReadyState = 4
Application.DoEvents
Loop
'取数据
Dim Cols() As String = { "序号","考试日期","考试场地","考试场次","普通预约计划","优先预约计划","操作" }
Dim elems As object = web.Document.GetElementById("list_elem").GetElementsByTagName("tr")
Dim m As Integer = 0
For Each elem As object In elems
Dim i As Integer = -1
m = m + 1
If m > 1 Then '因为网页的表格有标题,如果不判断,就会增加出一个空行
Tables("考试预约计划表").AddNew
End If
Dim tdelems As object = elem.GetElementsByTagName("td")
For Each tdelem As object In tdelems
i = i + 1
Tables("考试预约计划表").Current(Cols(i)) = tdelem.Innertext
Next
Next
不能实现导出网页https://hb.122.gov.cn/views/examappointpub.html的数据,再请版主指点一下,谢谢