P
Philippe Boudier
Guest
Bonjour,
J'ai un soucis que je n'arrive pas à résoudre et je remercie d'avance la personne qui résoudra mon problème.
J'ai fait un progamme VBA (voir ci dessous) qui me permet de faire une requête sous Query à partir d'un fichier DBF. Dans certains champs il y a des dates que je souhaiterais paramétrer dans des cellules Excel ( date début et fin). Je n'arrive pas à trouver la syntaxe qui me permettrait de changer les dates en dur dans le programme par une liaison avec les cellules Excel ou des constantes qui feraient référence au contenu de ces cellules.
D'avance merci.
Cordialement
With ActiveSheet.QueryTables.Add(Connection:=Array(Array( _
"ODBC;DRIVER={Hyper File};ANA=G:\DONNEES\TRAMICO\ANALYSE\TRAMICO.WDD;;REP=G:\DONNEES\TRAMICO\FIC\;ANA=G:\DONNEES\TRAMICO\ANALYSE\TRAM" _
), Array("ICO.WDD")), Destination:=Range("A1"))
.CommandText = Array( _
"SELECT BOAP.BODPCODE, BOAP.BODPDATE, BOAP.CC_PCODE, BOAP.ST_PCODE, BOAP.BOAPQTEL, BOAP.AR_PPRIX, BOAP.AR_PUTAR" & Chr(13) & "" & Chr(10) & "FROM G:\DONNEES\TRAMICO\ANALYSE\TRAMICO.WDD~BOAP BOAP" & Chr(13) & "" & Chr(10) & "WHERE (BOAP.BODPDATE>={d '2003-12-02'} And BOAP.BODPDATE<={d '2003-12-04'})" _
, "AND (BOAP.BODPCODE<>'Z' And BOAP.BODPCODE<>'Z')" _
, "" & Chr(13) & "" & Chr(10) & "ORDER BY BOAP.BODPDATE, BOAP.CC_PCODE, BOAP.ST_PCODE")
.Name = "tri des Produits"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
J'ai un soucis que je n'arrive pas à résoudre et je remercie d'avance la personne qui résoudra mon problème.
J'ai fait un progamme VBA (voir ci dessous) qui me permet de faire une requête sous Query à partir d'un fichier DBF. Dans certains champs il y a des dates que je souhaiterais paramétrer dans des cellules Excel ( date début et fin). Je n'arrive pas à trouver la syntaxe qui me permettrait de changer les dates en dur dans le programme par une liaison avec les cellules Excel ou des constantes qui feraient référence au contenu de ces cellules.
D'avance merci.
Cordialement
With ActiveSheet.QueryTables.Add(Connection:=Array(Array( _
"ODBC;DRIVER={Hyper File};ANA=G:\DONNEES\TRAMICO\ANALYSE\TRAMICO.WDD;;REP=G:\DONNEES\TRAMICO\FIC\;ANA=G:\DONNEES\TRAMICO\ANALYSE\TRAM" _
), Array("ICO.WDD")), Destination:=Range("A1"))
.CommandText = Array( _
"SELECT BOAP.BODPCODE, BOAP.BODPDATE, BOAP.CC_PCODE, BOAP.ST_PCODE, BOAP.BOAPQTEL, BOAP.AR_PPRIX, BOAP.AR_PUTAR" & Chr(13) & "" & Chr(10) & "FROM G:\DONNEES\TRAMICO\ANALYSE\TRAMICO.WDD~BOAP BOAP" & Chr(13) & "" & Chr(10) & "WHERE (BOAP.BODPDATE>={d '2003-12-02'} And BOAP.BODPDATE<={d '2003-12-04'})" _
, "AND (BOAP.BODPCODE<>'Z' And BOAP.BODPCODE<>'Z')" _
, "" & Chr(13) & "" & Chr(10) & "ORDER BY BOAP.BODPDATE, BOAP.CC_PCODE, BOAP.ST_PCODE")
.Name = "tri des Produits"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False