1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
Sub RefreshDatas()
'
' RefreshDatas Macro
'
'
Cells.Select
Selection.ListObject.QueryTable.Delete
Selection.ClearContents
With ActiveSheet.ListObjects.Add(SourceType:=0, Source:= _
"ODBC;DATABASE=oganc;DSN=MySQL Test;OPTION=0;;PORT=0;SERVER=194.116.144.84;UID=mantis;" _
, Destination:=Range("$A$1")).QueryTable
.CommandText = Array( _
"SELECT stats_0.`Id de l'action`, stats_0.Secteur, stats_0.`Type de l'action`, stats_0.`Assignée à`, stats_0.Projet, stats_0.Client, stats_0.`Chef de projet`, stats_0.`Id de la NC`, stats_0.`Type de la" _
, _
" NC`, stats_0.`Nom de la NC`, stats_0.`Description de la NC`, stats_0.`Cause racine de la NC`, stats_0.Criticité, stats_0.Champ, stats_0.`Etat de la NC`, stats_0.`Date de fermeture de la NC`, stats_0." _
, _
"`Description de l'action`, stats_0.`Cause racine de l'action`, stats_0.`Etat de l'action`, stats_0.`Date cible`, stats_0.Efficacité, stats_0.`Date de vérification de l'action`" & Chr(13) & "" & Chr(10) & "FROM oganc.stats stats_" _
, "0")
.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_Lancer_la_requête_à_partir_de_MySQL_Test_1"
.Refresh BackgroundQuery:=False
End With
End Sub |
Partager