1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| With ActiveSheet.ListObjects.Add(SourceType:=0, Source:=Array( _
"OLEDB;Provider=SQLOLEDB.1;Persist Security Info=True;User ID=eeeeee;Password=eeeee;Data Source=eeeeeee;Use Procedure for Prepare=1;Auto Translate=" _
, _
"True;Packet Size=4096;Workstation ID=eeeeeeeee;Use Encryption for Data=False;Tag with column collation when possible=False;In" _
, "itial Catalog=DB35"), Destination:=Range("$A$1")).QueryTable
.CommandType = xlCmdTable
.CommandText = Array("""DB35"".""dbo"".""TOTO""")
.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 |