This topic has been covered extensively in other posts, but I have a peculiar problem that I cannot solve. On a spreadsheet, I create a webquery using a macro.
Everytime I use the:
"Set QT = ActiveSheet.QueryTables.Add(Connection:=totalline, Destination:=Range("A1"))"
command, it takes 15-20 seconds to perform that one line. (NOTE: the "totalline" variable is a website, for ex: "URL; and QT is defined as a QueryTable type). Stepping through the code, this seems odd because it is not actually querying the website at this point, it is only setting up the querytable command.
The call to the webquery is as follows:
"
With QT
.Name = "ks?s=AA"
.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 = """yfncsubtit"",17,22,25,28,31,34,37,45,48,51"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
"
I am completely mystified about why this would take so long. I have used different internet connections and different computers, and the result is the same... a 20 second wait on the QT = activesheet.querytable.add command. I would greatly appreciate any thoughts you have.
-PM
Everytime I use the:
"Set QT = ActiveSheet.QueryTables.Add(Connection:=totalline, Destination:=Range("A1"))"
command, it takes 15-20 seconds to perform that one line. (NOTE: the "totalline" variable is a website, for ex: "URL; and QT is defined as a QueryTable type). Stepping through the code, this seems odd because it is not actually querying the website at this point, it is only setting up the querytable command.
The call to the webquery is as follows:
"
With QT
.Name = "ks?s=AA"
.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 = """yfncsubtit"",17,22,25,28,31,34,37,45,48,51"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
"
I am completely mystified about why this would take so long. I have used different internet connections and different computers, and the result is the same... a 20 second wait on the QT = activesheet.querytable.add command. I would greatly appreciate any thoughts you have.
-PM