Make sure your BackgroundQuery is set to False
With ActiveSheet.QueryTables.Add( _
Connection:=sConn, _
Destination:=ResultLocation, _
Sql:=sSql)
.RefreshStyle = xlOverwriteCells 'Over-write the existing data from previous queries
.AdjustColumnWidth = False 'Prevents the query from adjusting the column width every time it runs
.RefreshOnFileOpen = False 'Shutsdown the automatic refresh function
'.FieldNames = False 'Hides the column headers that come from the query
.Refresh BackgroundQuery:=False 'Actually sends this query, the background false options prevents the program from continuing until the refresh is complete
End With
|