谢谢!!已经解决! 得到了想要的数据并存入表,数据保存到表格部分的代码参考自本论坛的前靠先进之手!感谢!
以下内容为程序代码:
1 Dim Cols() As String = {"date","moneda","compra","venta"}
2
3 Dim web As New System.Windows.Forms.WebBrowser()
4
5 web.ScriptErrorsSuppressed = True
6
7 web.Navigate("http://www.cambioschaco.com.py")
8
9 Do Until web.ReadyState = 4 AndAlso web.Document.GetElementByid("main-exchange-content").InnerText > ""
10 Application.DoEvents
11 Loop
12
13 Dim tb As object = web.Document.GetElementById("main-exchange-content")
14 Dim trs As object = tb.GetElementsByTagName("tr")
15 Dim i As Integer = 1
16
17 For Each tr As object In trs
18 Dim tds As object = tr.GetElementsByTagName("td")
19 Dim time As object = web.Document.GetElementById("update-ts")
20 Tables("cambios").AddNew
21
22 If i <= 3 Then
23 For Each td As object In tds
24 Tables("cambios").Current("date") = time.Innertext
25 Tables("cambios").Current(Cols(i)) = td.Innertext
26 i = i + 1
27 Next
28 ElseIf i > 3 Then
29 i = i - 3
30 For Each td As object In tds
31 Tables("cambios").Current("date") = time.Innertext
32 Tables("cambios").Current(Cols(i)) = td.Innertext
33 i = i + 1
34 Next
35 End If
36
37 Next
38
39 DataTables("cambios").Save
40
此主题相关图片如下:011.jpg
下一步,将date列的字符型数据转换成日期型:03 MAR 2017 13:54 。