ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Opt Out of a Query. (https://www.excelbanter.com/excel-programming/320380-re-opt-out-query.html)

Rob van Gelder[_4_]

Opt Out of a Query.
 
That second to last line should have actually read:

AnyQueryTablesRefreshing = bln

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Rob van Gelder" wrote in message
news:...
If your query is in fact an Excel QueryTable, then you could check the
Refreshing property of each QueryTable.
To cancel a refreshing QueryTable, run the CancelRefresh method.

Sub AllQueryTablesCancelRefresh()
Dim qtb As QueryTable

For Each qtb In ActiveSheet.QueryTables
If qtb.Refreshing Then qtb.CancelRefresh
Next
End Sub


Function AnyQueryTablesRefreshing() As Boolean
Dim qtb As QueryTable, bln As Boolean

bln = False
For Each qtb In ActiveSheet.QueryTables
If qtb.Refreshing Then
bln = True
Exit For
End If
Next
AnyQueryTablesRefreshing = False
End Function


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Nicholas" wrote in message
...
I have a worksheet with a macro that grabs information from many URL
sources.
The macro looks for information within the query date entries after a
button
selection. What I would like to incorperate is a button to suspend the
macro. Or even better a message box stating the query is being compiled
with possibly a Cancel button.







All times are GMT +1. The time now is 11:01 PM.

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