Reputation: 672
I currently have a webquery that after I refresh the connection, I then have to edit it to make it usable. When I made the macro to do so, it didn't record the refresh Connection part, which if it doesn't work, the number of records I have will go down everytime. Does anyone know what I could insert into the Macro with Visual Basic to get it to refresh the Webquery connection first. Currently, the macro looks like this
The connection's name is Standings
Sub Baseball()
'
' Baseball Macro
'
'
Range("1:3,10:10,16:16,22:24,30:30,36:36,42:46").Select
Range("A42").Activate
Selection.Delete Shift:=xlUp
Range("A1").Select
ActiveCell.FormulaR1C1 = "Team"
Rows("1:1").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ActiveWorkbook.Save
End Sub
Upvotes: 1
Views: 244
Reputation: 123839
Does anyone know what I could insert into the Macro with Visual Basic to get it to refresh the Webquery connection first
...
The connection's name is Standings
It looks like...
ActiveWorkbook.Connections("Standings").Refresh
...should do it.
Upvotes: 1