Desu Nota from Columbus
Well-known Member
- Joined
- Mar 17, 2011
- Messages
- 556
Rich (BB code):
With ActiveSheet.QueryTables.Add(Connection:=Array(Array( _
"ODBC;DRIVER=SQL Server;SERVER=GGVORNE\SQLEXPRESS;UID=vorne;Pwd=VData!!!;APP=Microsoft Office 2003;WSID=MXL0261CPP;Network=DBMSSOCN;Address=GGVORN" _
), Array("E\SQLEXPRESS,49181")), Destination:=Range("A1"))
.CommandType = xlCmdSql
.CommandText = Array("""VORNEDB"".""dbo"".""interval_stream""")
.Name = "Query from VorneDSN"
.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
I'm not even sure if this macro will work, but I can't test it until this line will work.