Use a code similar to this one in VBA:
Include following References: Microsoft ActiveX Data Objects 6.* Library
Be sure to return values as “datetime” instead of “date” or “datetime2” to get recognized as a date value in Excel.
Public Sub GetDwhData()
Dim wksTarget As Worksheet: Set wksTarget = Worksheets(1)
Dim cellAddressStart As String: cellAddressStart = "B2"
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
On Error GoTo ErrHandling
Set objMyConn = New ADODB.Connection
Set objMyRecordset = New ADODB.Recordset
Dim strSQL As String
objMyConn.ConnectionString = "Provider=SQLOLEDB;Data Source=tcp:localhost,1344;Initial Catalog=DWH;Integrated Security=SSPI"
objMyConn.Open
strSQL = "select TOP 1000 * from dbo.Datasource"
Set objMyRecordset.ActiveConnection = objMyConn
objMyRecordset.Open strSQL
'Copy Data to Excel...
wksTarget.Range(cellAddressStart).CopyFromRecordset (objMyRecordset)
objMyRecordset.Close
objMyConn.Close
wksTarget.Calculate 'Formeln neu berechnen
ErrHandling:
Application.Calculation = xlCalculationSemiautomatic
Application.ScreenUpdating = True
End Sub