【发布时间】:2011-02-04 01:29:25
【问题描述】:
我可以从已知的 ulr 中提取数据,但我可以使用 excel 浏览网站。
例如,可以用 excel 进行谷歌搜索并将结果放在电子表格中。或浏览框架内网站。
此代码从网站中提取数据。
With ActiveSheet.QueryTables.Add(Connection:= _
PUT_URL_HERE, _
Destination:=Range("A1"))
.Name = "I need serious help"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.WebSelectionType = xlAllTables
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
【问题讨论】:
-
创建一个宏来跟踪我进行网络查询并不能完全破解它。
-
考虑导航基于 HTML 的网站涉及的内容:您需要发送带有适当数据的请求,然后读取返回的文档。 Excel 可以通过引用适当的库来通过 VBA 完成这两件事
-
很高兴知道这是可能的。你知道任何好的来源,或者这样做的例子吗