1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| With ActiveSheet.ListObjects.Add(SourceType:=0, Source:= _
"ODBC;DRIVER={MySQL ODBC 5.1 Driver};UID=user;PASSWORD=****;SERVER=host;DATABASE=db1;PORT=3306;" _
, Destination:=Range("$S$14")).QueryTable
.CommandText = Array( _
"select h.name,a.tag, h.userid from accountinfo a inner join hardware h on a.hardware_id = h.id where h.NAME in ( 'S2','S42','P15','E41','ER01" _
, _
"41','M98','SE31','SE31','SE59','S02','SR76','S995','SP95','S32');" _
)
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.ListObject.DisplayName = "Tableau_Requête_n°2"
.Refresh BackgroundQuery:=False
End With |
Partager