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
| Sub Macro1()
Application.CutCopyMode = False
With ActiveSheet.ListObjects.Add(SourceType:=0, Source:=Array(Array( _
"ODBC;DSN=Excel Files;DBQ=P:\POIDS\Miroir_Compilation_Ligne_sachets_T1.xlsx;DefaultDir=P:\POIDS;DriverId=1046;MaxBufferSize=2048;Page" _
), Array("Timeout=5;")), Destination:=Range("$A$10")).QueryTable
.CommandText = Array( _
"SELECT TEVO_1.Clé, TEVO_1.Date, TEVO_1.Equipe, TEVO_1.Code_article, TEVO_1.Lot, TEVO_1.Poid_cible, TEVO_1.Nb_UVC_Prod, TEVO_1.Tare, TEVO_1.Visa, TEVO_1.Heure, TEVO_1.Poids_Net_1, TEVO_1.Poids_Net_2" & Chr(13) & "" & Chr(10) & "F" _
, _
"ROM `P:\POIDS\Miroir_Compilation_Ligne_sachets_T1.xlsx`.TEVO_1 TEVO_1" & Chr(13) & "" & Chr(10) & "WHERE (TEVO_1.Clé='919103_83452')" _
)
.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_Excel_Files"
.Refresh BackgroundQuery:=False
End With
End Sub |
Partager