我正在尝试从https://support.software.dell.com/appassure/kb
下的多个网页中提取特定数据我有兴趣提取文章标题,最后更新字段,KB视图和评分(总共四个字段)
所有知识库文章的默认页数为40,而我尝试过的Excel中的基本网页查询无效。
我还审核了Microsoft Excel 2010 Web Query Macro: Pulling Multiple Pages From One,但它没有用。
任何帮助都会很棒!
答案 0 :(得分:1)
要使用for循环(例如
)循环您需要的网站For i = 1 to 40
....
... = "https://support.software.dell.com/appassure/kb?p=" & i
....
next
(对我来说,导入工作正常)
我只是快速检查一下:
Sub test()
Dim i As Long
For i = 1 To 40
MsgBox "get page number" & i
With ActiveSheet.QueryTables.Add(Connection:="URL;https://support.software.dell.com/appassure/kb?p=" & i, Destination:=Range("$A$1"))
.Name = "testing"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
Next
End Sub