Just create an ODBC data source and use that from excel
You looking for something like this?
Code:
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 13/11/2007 by PDreyer
'
'
With ActiveSheet.QueryTables.Add(Connection:= _
"ODBC;DRIVER={Sybase ASE ODBC Driver};NA=host1,4100;DB=master;UID=PDreyer;" _
, Destination:=Range("A1"))
.CommandText = Array( _
"SELECT sysdatabases.name" & Chr(13) & "" & Chr(10) & "FROM master.dbo.sysdatabases sysdatabases")
.Name = "Query from srv1"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
End With
End Sub