ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cancel QueryTables.Refresh Process After 10 Seconds (https://www.excelbanter.com/excel-programming/339080-cancel-querytables-refresh-process-after-10-seconds.html)

McP

Cancel QueryTables.Refresh Process After 10 Seconds
 
When I .Refresh the following QueryTables.Add statement, the process can run
for several minutes. How do I automatically cancel the Refresh after 10
seconds? Do I use a combination of DoEvents and/or .BackgroundQuery = True?
Excel is locked until the refresh and textfile import have completed.

With ParseSheet.QueryTables.Add(Connection:=ScrapeURL,
Destination:=ParseSheet.Range("A1"))
'.Name = ScrapeURL
..FieldNames = True
..RowNumbers = False
..FillAdjacentFormulas = False
..PreserveFormatting = True
..RefreshOnFileOpen = False
..RefreshStyle = xlOverwriteCells
..SavePassword = False
..SaveData = True
..AdjustColumnWidth = False
..RefreshPeriod = 0
..TextFilePromptOnRefresh = False
..TextFilePlatform = 1252
..TextFileStartRow = 1
..TextFileParseType = xlDelimited
..TextFileTextQualifier = xlTextQualifierDoubleQuote
..TextFileConsecutiveDelimiter = False
..TextFileTabDelimiter = False
..TextFileSemicolonDelimiter = False
..TextFileCommaDelimiter = False
..TextFileSpaceDelimiter = False
..TextFileOtherDelimiter = ":"
..TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1)
..TextFileTrailingMinusNumbers = False
..BackgroundQuery = False
..Refresh
End With



All times are GMT +1. The time now is 11:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com