1
我想实现一个代码,我可以从一个网站导入多个表格。我可以使用下面的代码。但是,代码太慢了。从网页将表格导入excel快速
Sub FetchData()
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;%url%", Destination:=Range(_
"$A$1"))
.Name = "xyz"
.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
End Sub
有人可以建议一个代码,将提供输出快?
什么是“慢”? 10秒?一分钟?检索网页可能是瓶颈。 – JJJ
阻止您通过手动创建Web查询并在VBA中刷新它? –
需要4分钟。它为我工作。这不是问题。但是,如果某些代码使其从网络中导入表格的速度稍快,我希望它可以。 – user2650238