老大,我在Excel的论坛找到一段VB 可以从网页上抓取数据的代码,怎么整合到狐表中?
Option Explicit
Sub a()
Dim ie1 As Object, dmt As Object, r As Object, i As Long, j As Long
'Load UserForm1
'UserForm1.Show 0
[a1].CurrentRegion.Clear
Cells.NumberFormat = "@"
Set ie1 = UserForm1.WebBrowser1
With ie1
.Navigate "http://ball365.net/newo/mpk.html?ct=1317477534001" '网址
Do Until .ReadyState = 4
DoEvents
Loop
Set dmt = .Document
End With
Application.ScreenUpdating = False
Set r = dmt.All.tags("table")(35).Rows
For i = 0 To r.Length - 1
For j = 0 To r(i).Cells.Length - 1
Cells(i + 1, j + 1) = r(i).Cells(j).innerText
Next
Next
Application.ScreenUpdating = True
Set ie1 = Nothing
Set dmt = Nothing
Set r = Nothing
[a1].CurrentRegion.Columns.AutoFit
End Sub