其实很容易的 用Microsoft Internet Controls。。也就是我们常用的 WebBrowser控件
具体代码
Private Sub Command1_Click()
On Error Resume Next
Dim a As String
Dim i As Long
Dim j As Long
WebBrowser1.Navigate "http://pszx.szlg.edu.cn/cgi-bin/awstats.pl?config=pszx.szlg.edu.cn&framename=mainright&output=errors404" '这个自己打
'这个 加点延迟吧 网页打开比较慢
t = Timer
While Timer - t < 3
DoEvents
Wend
'获取网页源码 放到a里面
a = WebBrowser1.Document.body.outerhtml
j = 1
i = InStr(i + 1, a, "<TR>" + vbCrLf + "<TD class=aws>")
While (i <> 0 And j <> 0)
i = InStr(i + 1, a, "<TR>" + vbCrLf + "<TD class=aws>")
While (j < i And j <> 0)
j = InStr(j + 1, a, "</TD>" + vbCrLf + "<TD>")
Wend
b = Mid(a, i + Len("<TR>" + vbCrLf + "<TD class=aws>"), j - i - Len("<TR>" + vbCrLf + "<TD class=aws>"))
Text1.Text = Text1.Text + b + vbCrLf
DoEvents
Wend