Excel 求教大神,VBA提取网站数据
1个回答
展开全部
正好我有一个这个程序,给你参考一下:
Sub 网页抓取()
Dim i
For i = 2010 To 2014
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.chinabond.com.cn/jsp/include/EJB/document.jsp?sId=0102&sBbly=" & i & "06&sMimeType=4", _
Destination:=Cells(1, i))
.Name = "sheet001"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlAllTables
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
Next
End Sub
Sub 网页抓取()
Dim i
For i = 2010 To 2014
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.chinabond.com.cn/jsp/include/EJB/document.jsp?sId=0102&sBbly=" & i & "06&sMimeType=4", _
Destination:=Cells(1, i))
.Name = "sheet001"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlAllTables
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
Next
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询