内存溢出。不要在循环里不断new浏览器实例
Dim web As New System.Windows.Forms.WebBrowser()
web.ScriptErrorsSuppressed = True
For Each dr As DataRow In DataTables("表A").Select("","简码")
If dr.IsNull("简码") = False And dr.IsNull("行业") Then
web.Navigate("https://vip.stock.finance.sina.com.cn/corp/go.php/vCI_CorpOtherInfo/stockid/" & dr("简码") & "/menu_num/2.phtml")
Do Until web.ReadyState = 4
Application.DoEvents
Loop
Dim hy As String = ""
Dim tb1 As object = web.Document.GetElementsByTagName("table")(3)
Dim trs1 = tb1.GetElementsByTagName("tr")
Dim tds1 As object = trs1(2).GetElementsByTagName("td")
hy = tds1(0).innerText
If hy = "" Then
hy = "无"
End If
Dim gn As String = ""
Dim tb2 As object = web.Document.GetElementsByTagName("table")(4)
Dim trs2 = tb2.GetElementsByTagName("tr")
For i2 As Integer = 1 To trs2.count-1
Dim tds2 As object = trs2(i2).GetElementsByTagName("td")
If tds2.count > 0
If gn = "" Then
gn = tds2(0).innerText
Else
gn = gn & "," & tds2(0).innerText
End If
End If
Next
If gn = "对不起,暂时没有相关概念板块信息" Then
gn = "无"
End If
dr("行业") = hy
dr("概念") = gn
GC.Collect()
End If
Next
DataTables("表A").Save()