要自己懂得分析,把帮助文档看一下 http://msdn.microsoft.com/zh-cn/library/system.windows.forms.htmlelement.aspx
Dim web As New System.Windows.Forms.WebBrowser()
web.Navigate("http://www.chinatimber.org/bj/default.asp")
Do Until web.ReadyState = 4
Application.DoEvents
Loop
'取数据
Dim Cols() As String = { "产品","", "", "类别","规格","等级","产地","价格","单位","日期","报价企业" }
Dim elems As object
For Each tb As Object In web.Document.GetElementsByTagName("table")
If tb.GetAttribute("bgcolor") = "#CCCCCC" Then
elems = tb.GetElementsByTagName("tr")
Exit For
End If
Next
For Each elem As object In elems
Dim tdelems As object = elem.GetElementsByTagName("td")
If tdelems.count > 9 Then
Dim nr As Row = Tables("木材").AddNew
Dim i As Integer = -1
For Each tdelem As object In tdelems
i = i + 1
If Cols(i) > "" Then
nr(Cols(i)) = tdelem.Innertext
End If
Next
End If
Next
Tables("木材").save