I have tested the majority of the code from my Office 2010 macros on a Office 2013 machine, but one part seems to need updating.
It breaks at the ".Refresh BackgroundQuery:=False" line, which means it isn't updating/pulling the data.![]()
Sub RunQuery(Cnnect, SQLStuff, NameofRange) With ActiveSheet.QueryTables.Add( _ Connection:=Cnnect, _ Destination:=Range("$A$1"), _ Sql:=SQLStuff) .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .BackgroundQuery = False .Name = NameofRange .RefreshPeriod = 0 .Refresh BackgroundQuery:=False .RefreshStyle = xlInsertDeleteCells .SaveData = True .Refresh End With End Sub
I had read that if you remove the 'ODBC;' part from the query language it would work but that turned out untrue.
Can anyone assist?
Bookmarks