我有一个使用“来自 Web 的数据”功能的宏。我已经登录了要从中提取数据的网站(在 Internet Explorer 中) - 但我在 Excel 中得到的结果只是一直告诉我我没有登录。
是否有通过 Excel 登录“来自 Web 的数据”的特殊方法?我知道它有效,因为我使用宏记录器来了解 Excel 如何获取数据 - 并且手动执行此操作,网站要求我登录“Excel IE 浏览器窗口”......但已经一个多小时了,所以我被注销。如何重新登录才能使用它?
如果有帮助,这是适用的数据提取代码(登录后 URL 工作正常):
With ActiveSheet.QueryTables.Add(Connection:="URL;" & theURL, Destination:=webInfoWS.Range("$A$2"))
.name = cel.Value & " hex"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "3"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
