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
| Sub Macro2()
'
' Macro2 Macro
' Macro enregistrée le 18/04/2011 par ghammmouni
'
'
With ActiveSheet.QueryTables.Add(Connection:=Array(Array( _
"ODBC;DRIVER={Client Access ODBC Driver (32-bit)};PKG=QGPL/DEFAULT(IBM),2,0,1,0,512;LANGUAGEID=ENU;DFTPKGLIB=QGPL;DBQ=CIFH0;SYSTEM=HE" _
), Array("PSTG;")), Destination:=Range("A1"))
.CommandText = Array("SELECT * FROM ""CIFH0"".""BDEVECOLI""")
.Name = "ERM"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.SourceConnectionFile = _
"C:\Program Files\Fichiers communs\ODBC\Data Sources\ERM.dsn"
.refresh BackgroundQuery:=False
End With
End Sub |