joeyslaptop
New Member
- Joined
- Aug 26, 2011
- Messages
- 27
I'm trying to create a macro that does the following:
On theButton was clicked
set theButton style =msoShapeStylePreset12
Run the query
Query refresh completes
set theButton style = msoShapeStylePreset14
end
But, the button doesn't change until after the query has refreshed. I eve tried putting it in a loop with a condition:
On theButton was clicked
set theButton style =msoShapeStylePreset12
Run the query
Query refresh completes
set theButton style = msoShapeStylePreset14
end
But, the button doesn't change until after the query has refreshed. I eve tried putting it in a loop with a condition:
Code:
Sub RefreshQueries()
'
' RefreshQueries Macro
' This macro triggers when the button is pushed. It refreshes the queries that produce the datasets.
Dim Looper As Integer
Looper = 1
Do
'change the button to yellow.
Sheets("Stats").Shapes("Rounded Rectangle 1").ShapeStyle = msoShapeStylePreset12
Looper = 2
If Looper = 2 Then
'Do query refresh.
ActiveSheet.Shapes.Range(Array("Rounded Rectangle 1")).Select
Sheets("Mbrs to Renew").Range("H2").ListObject.QueryTable.Refresh BackgroundQuery:=False
Looper = 3
End If
Loop Until Looper = 3
'change the button back to green.
Sheets("Stats").Shapes("Rounded Rectangle 1").ShapeStyle = msoShapeStylePreset14
End Sub
Last edited: